By Alvin Alexander. Last updated: July 30, 2024
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:
- Start with an OOP foundation, such as using Java, Kotlin, and other OOP languages
- Take a look at how you write methods in OOP languages
- Then look at how to solve problems using pure functions (and data types), and see how those functions are different from methods
- Add in immutable (algebraic) variables
- Add in immutable data structures
- Lastly, add in functional error-handling using Scala’s
Option
,Try
, andEither
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.