Chapters

Hide chapters

Functional Programming in Kotlin by Tutorials

First Edition · Android 12 · Kotlin 1.6 · IntelliJ IDEA 2022

Section I: Functional Programming Fundamentals

Section 1: 8 chapters
Show chapters Hide chapters

Appendix

Section 4: 13 chapters
Show chapters Hide chapters

v. Introduction
Written by Massimo Carli

Functional programming is a paradigm for writing your code. It’s an alternative to object-oriented programming that focuses more on functions and composition than objects and classes. Rather than writing your code to say how to do something, you declare what to do.

In many contexts, learning functional programming can feel like an academic exercise. The point here is to show you how to use it in your everyday app development work. In this book, you’ll take a hands-on approach to apply functional programming in a practical way. You’ll build on knowledge you already have while approaching these new topics.

You’ll take a pragmatic approach to learn how to make your code more:

  • Declarative
  • Robust
  • Error-proof

You’ll learn this and much more in Chapter 1. By the end of this book, you’ll know how to apply pure functions, immutability and composition to simplify your complex logic!

How to read this book

This book is written to be read linearly. That said, functional programming is a vast topic, and chapters often call back to previous chapters. It’s expected that you’ll end up rereading chapters as you progress through the book and learn about related concepts.

This book is split into four main sections:

Section I: Functional Programming Fundamentals

This is the very start of your functional programming journey. Here, you’ll learn what functional programming is and why it’s useful as well as its fundamental concepts. Using hands-on examples every step of the way, you’ll discover pure functions, higher-order functions, composition and so much more!

Section II: Data Types & Typeclasses

In this section, you’ll learn some of the types you see when using functional programming. You’ll see concepts you likely already know, like “List” and “Optional”, while discovering some of their very important properties as they relate to functional programming.

Section III: Functional Programming in Practice

Time to put all that knowledge to work. In this section, you’ll use all the principles you’ve learned so far to see the functional programming way for handling errors and managing state changes. You’ll also meet some libraries you can use in your projects to quickly introduce functional programming.

Appendix

This book has many exercises and challenges throughout. In this appendix, you’ll find solutions to all exercises and challenges, along with additional explanations about the answers.

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.
© 2024 Kodeco Inc.