About This Title

Pages: 325
Published: April 2022
ISBN: 9781680508451
Edition: 1
In Beta

Skill Level Meter

From Objects to Functions

Build Your Software Faster and Safer with Functional Programming and Kotlin

by Uberto Barbini

Build applications quicker and with less effort using functional programming and Kotlin. Learn by building a complete application, from gathering requirements to delivering a microservice architecture following functional programming principles. Learn how to implement CQRS and EventSourcing in a functional way to map the domain into code better and to keep the cost of change low for the whole application life cycle.

If you’re curious about functional programming or you are struggling with how to put it into practice, this guide will help you increase your productivity composing small functions together instead of creating fat objects.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $25.95 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal

This book is in Beta, final version expected Apr 2022

Beta Books: What do I get?


Switching to the functional paradigm isn’t easy when you’re used to object-oriented programming. You need more than just lambdas and mapping over collections to get a declarative style and disentangle the state from the computations. Use transformations and compositions to help you write less code with better results. Boost your productivity and harness the power of functional programming by creating real-world applications rather than focusing on theoretical concepts.

Work through a series of short exercises to find and compose pure functions, and create data structures that work like algebra. Get rid of mutable state in your software to eliminate the main source of bugs. Apply CQRS and EventSourcing patterns to translate stakeholder requirements into functional design and then into code. See how Kotlin’s easy-to-learn syntax and functional-friendly approach make it a great option for a pragmatic language that integrates well with existing Java code and libraries.

Leverage functional programming to build and deliver robust applications in less time and with fewer defects.

What You Need

The code in this book is designed to allow you to build your application from scratch on Windows, Mac and Linux. You will need a recent IDE, we recommend IntelliJ Community Edition, and Kotlin 1.3.x or later.

Resources

Releases:

  • B1.0 2021/09/20

Contents & Extracts

Note: Contents and extracts of beta books will change as the book is developed.

  • Preface
    • About This Book
  • Introduction: Why Functional Programming?
    • Why Kotlin?
    • Defining Functional Programming
    • Unlearning Object-Oriented Programming
    • Recap
  • Preparing a New Application
    • Defining the Sample Application
    • Letting Tests Guide the Development
    • Setting Up the Zettai Project
    • Making Unit Tests Functional
    • Recap
    • Exercises
  • Using Functions to Handle HTTP Requests
    • Kicking Off the Project
    • Serving HTML Pages Functionally
    • Starting Zettai
    • Designing with Arrows
    • Serving Lists from a Map
    • Recap
    • Exercises
  • Functional Testing and Domain Modeling
  • Connecting the Domain to Adapters
    • Starting a New Story to Modify a List excerpt
    • Using Functional Dependency Injection
    • Debugging Functional Code
    • Functional Domain Modeling
    • Recap
    • Exercises
  • Using Events to Modify the State
    • Creating and Displaying To-Do Lists
    • Storing the State Changes
    • Unleashing the Power of Recursion
    • Working with Mutable Entities
    • Discovering the Monoid
    • Recap
    • Exercises
  • Executing Commands to Generate Events
    • Creating a New List
    • Using Commands to Change the State
    • Modeling the Domain with States and Events
    • Writing Functional State Machines
    • Connecting the Hub
    • Understanding Commands and Events Better
    • Recap
    • Exercises
  • Handling Errors Functionally
    • Handling Errors Better
    • Learning Functors and Categories
    • Using Functors to Handle Errors
    • Recap
    • Exercises
  • Using Functors to Project Events
    • Projecting Our Events
    • Running Queries
    • Thinking in Terms of Functors
    • Recap
    • Exercises
  • Using Monads to Persist Data Safely
    • Persisting Safely
    • Accessing the Database with Kotlin
    • Accessing Remote Data in a Functional Way
    • Exploring the Power of Monads
    • Recap
    • Exercises
  • Reading Context to Handle Commands
    • Accessing the Database with Monads excerpt
    • Handling Commands with Context Reader
    • Querying Projections from Database
    • Modeling the Domain with Event Sourcing
    • Recap
    • Exercises
  • Validating Data with Applicatives
    • Renaming a List
    • Transforming Functions with Two Parameters
    • Validating with Validations
    • Combining Functors with Applicatives
    • Improving the User Interface
    • Recap
    • Exercises
  • Monitoring using Functional Concurrency
    • Making Json Functional
    • Understanding Monitoring and Logging
    • Parallelizing Operations with Async
    • Finishing the application
    • Adding Drag’n’Drop
    • Structured Monitoring
    • Recap
    • Exercises
  • Designing a Functional Architecture
    • Understanding Modular Architecture
    • Functional Micro-services
    • Distributing Commands and Queries
    • Final considerations
  • What Is Functional Programming
    • Getting a Taste of Functional Programming
    • Achieving Referential Transparency
    • Think in Morphisms
    • Recap
  • About Functional Kotlin
    • Setting Up Kotlin
    • Kotlin syntax sugar
    • Kotlin type system
    • Kotlin DSL syntax
    • Concurrency and Performance
  • About the Exercises
    • Exercises for chapter 1
    • Exercises for chapter 2
    • Exercises for chapter 3
    • Exercises for chapter 4
    • Exercises for chapter 5
    • Exercises for chapter 6
    • Exercises for chapter 7
    • Exercises for chapter 8
    • Exercises for chapter 9
    • Exercises for chapter 10
    • Exercises for chapter 11
  • A Pinch of Theory
    • Definition of a Category
    • Morphisms
    • Algebraic Data Types
    • Monoid
    • Functor

Author

Uberto is a very passionate programmer, starting when he created his first video game on the ZxSpectrum many years ago. He worked in all kinds of organizations, from the very big to the very small, coaching and helping teams build software in an efficient and sustainable way to create value for the company. He has used a range of functional languages (Haskell, Clojure, Scala), and he is currently in love with the simplicity of Kotlin and its productivity. He is a regular speaker at conferences around the world on Kotlin and Java, and he enjoys teaching courses and mentoring young programmers.

eBook Formats:

  • PDF for desktop/tablets

  • epub for Apple Books, e-readers

  • mobi for Kindle readers

Get all eBook formats here for $25.95 (USD)

Add to Cart we accept visa, mastercard, amex, discover, paypal

This book is in Beta, final version expected Apr 2022

Beta Books: What do I get?

Related Titles:

Skill Level Meter

About This Title

Pages: 325
Published: April 2022
ISBN: 9781680508451
Edition: 1
In Beta