The fastest way to learn functional programming (for Java/Kotlin/OOP developers)

When I was writing my new functional programming book — Learn Functional Programming Without Fear — a few alternate titles for the book were:

  • Learn Functional Programming the Fast Way!
  • The Fastest Way to Learn Functional Programming
  • From Object-Oriented Programming to Functional Programming
  • Helping Object-Oriented Programmers Learn Functional Programming
  • Functional Programming for Objected-Oriented Programmers

The fastest way for OOP developers to learn FP

That’s because I found out — almost by accident — that the fastest way for object-oriented programming (OOP) developers to learn functional programming (FP) goes like this:

  1. Start with an OOP foundation, such as using Java, Kotlin, and other OOP languages
  2. Take a look at how you write methods in OOP languages
  3. Then look at how to solve problems using pure functions (and data types), and see how those functions are different from methods
  4. Add in immutable (algebraic) variables
  5. Add in immutable data structures
  6. Lastly, add in functional error-handling using Scala’s Option, Try, and Either data types

As I show in Learn Functional Programming Without Fear, if you follow this “OOP to FP” journey correctly, you’ll now be ready to use Scala/FP libraries like ZIO and Cats Effect.