Functional Programming in Kotlin: From Simple to Reactive
300 pages
English
PDF
4.5

Functional Programming in Kotlin: From Simple to Reactive

Functional Programming in Kotlin: From Simple to Reactive

Author:

Year:

Summary:

The book "Functional Programming in Kotlin" is a practical guide that will help you master the paradigm of functional programming (FP) using the modern Kotlin language. Unlike purely functional languages, Kotlin combines object-oriented and functional approaches, making it an ideal choice for gradually introducing FP into real projects.



The book starts with the basics: pure functions, immutability, and higher-order functions. You will learn how to use lambda expressions, sequences, and collections in a functional style. The author then moves on to more complex concepts: currying, function composition, and recursion. Special attention is given to working with Option, Either, and Try — alternatives to exceptions that make code safer and more predictable.



The second part of the book is dedicated to monads and functors. You will analyze how to use map, flatMap, and fold for data processing, and learn to build transformation chains without side effects. Examples from real applications show how the functional approach simplifies testing and debugging.



The third part covers reactive programming and coroutines. You will learn how to combine a functional style with asynchrony: create reactive data streams, handle events, and manage state without blocking. The author demonstrates Functional Reactive Programming (FRP) patterns in Kotlin using Flow and Channels.



The book is intended for developers familiar with the basics of Kotlin but without experience in functional programming. After reading it, you will:



  • Learn to write pure functions without side effects
  • Master working with monads and functors for error handling
  • Be able to build reactive applications with coroutines and Flow
  • Learn how to refactor imperative code into functional code
  • Get ready-made recipes for typical tasks: parsing, validation, working with APIs


All examples in the book are accompanied by detailed comments and run on Kotlin 1.9+. To reinforce the material, each chapter ends with exercises and solutions. The book is suitable both for self-study and for preparing for interviews, where functional concepts are increasingly being asked about.



Whether you write server applications, Android mobile apps, or backend microservices — functional Kotlin will make your code more concise, reliable, and easy to maintain.

Recommendations