Functional Programming, Simplified: Updated for Scala 3 (PDF)
Welcome, this is the website where you can buy the PDF for my new book, Functional Programming, Simplified: Updated for Scala 3.
While this book is written in a simple, conversational style — just like I was sitting next to you in a pair-programming session — it’s also going to be a large book, probably over 800 pages. That being said, I think it will be 800 of the easiest-to-read pages you’ll ever find on FP. (And if you prefer a smaller book, see my links below.)
A Whole New World
Wow, a LOT of things have changed since the 1st Edition of this book was released in December, 2017. In fact, back then these technologies didn’t even exist:
- Scala 3
- Cats Effect 3
Therefore, it’s time to update one of the most popular and highly-rated functional programming (FP) books of all time: Functional Programming, Simplified.
What You Get Today
What you get with the book today (April 3, 2023) is the first 514 pages. Also, the book has been significantly rewritten, and is now written in application-centric style. The idea of the book is:
- We’ll start to write an application in an FP style
- As we write it, we’ll encounter problems that keep us from finishing the app
- We’ll then invent whatever we need to finish writing the app in an FP style
We’ll do this as many times as we need to until we’re writing Pure FP applications using ZIO.
The book will continue to avoid technical jargon and just focus on how to write applications using FP. It will also show how — if you had worked in FP years ago — you might have invented FP yourself.
What Will Be New In The Book
Because the 1st Edition was released over five years ago (December, 2017), there will be lots of new content in this release:
- All the Scala 3 goodies that pertain to FP (opaque types, extension methods, type classes, and more)
- All the code examples will be updated to Scala 3 (and improved)
- The new Scala CLI tool will be used to make it easier than ever to run the code examples
- Better coverage of functional domain modeling (ADTs, etc.)
- Akka and Futures are out, ZIO and Cats Effect are in
- More coverage of Option, Try, Either, and functional error handling
- Much more!
I don’t know yet how far I’ll go into ZIO and Cats Effect, but I’ll go at least as far as I did in my “Little FP Book,” Learn Functional Programming The Fast Way!
(I refer to this book as my “Big FP Book,” because it’s at least three times larger than that little book.)
About This Book
The first version of the book was written as ~125 small lessons. They were like a series of blog posts, where each lesson introduced only one new topic. Readers wrote me to say that they appreciated that:
- The book was written in a simple style
- Each lesson was small, self-contained, and logically led into the next lesson
- I provided links to over 600 resources
- I provided a ton of background detail about ALL the Scala features you need to know to understand FP
I’m glad to say that this new book will be written in that same style!
Just like the first book — depending on your level of knowledge and experience — you may be able to read each lesson in 5-10 minutes. And depending on your background, you may also be able to skip many of the lessons.
I could write more about the book, but I’ll leave that up to people who have sent me comments or posted comments on Amazon, Twitter, and LinkedIn, as you’ll see in the next section.
As of December, 2022, thousands of copies of this book have been sold, and it’s 5-star rated here with 42 ratings, and 4.6-star rated on Amazon, with 171 ratings.
Here’s some of the feedback from readers:
- Your book is fantastic, I can’t find enough words to thank you!
- Best Scala book I’ve read.
- This is a GREAT book!
- I finally understand monads. Thank you!
- I love the writing style and the approach, great job!
- I read this everyday after work and it makes me so happy. Thank you for this amazing book.
- I love the small lessons, they make it easy to read.
- The best $$$ spent on a tech book, ever.
- Thanks Alvin for opening the door for this new world.
- Your book was a real game changer to learn FP.
- Very nice explanation. Just awesome.
- Functional Programming Simplified is amazing, thank you for writing this.
- Too bad I can’t grade higher than 5 stars
- Exactly as promised, this book saves you a lot of time
- The best introduction to FP that I have read for people who are coming from an imperative background
- A very concise style that is easy to comprehend
Why I Wrote The 1st Edition
When I first tried to learn FP I felt hopelessly lost. I tried to learn it through books like the well-known “red book,” and as I tried to read that book, it was like the authors were speaking a totally different language — one that I couldn’t understand. They wanted me to do exercises at the end of every chapter, but I couldn’t, because I had no idea what they were talking about.
Frankly, books like that made me feel dumb, like there was no way I was ever going to learn FP.
However, as I would learn in a journey that took me about 18 months, it’s not that the red book isn’t a good book; it’s just that it’s not meant for beginners. It assumes that you already know a fair amount about FP before you even read it. (Put another way, it’s for intermediate or advanced FP’ers.)
Therefore, I wrote this book for beginners, for people like me.
In the book you’ll learn:
- Five important rules for writing FP code in Scala
- Why pure function signatures are much more important than OOP method signatures
- How pure functions work with I/O
- Lessons to simplify recursion
- Partially-applied functions and currying
- Type signatures are covered many times, so your brain can get used to patterns like `Either[String, GameState]`
- The proper way to handle exceptions and null values
- Many lessons on for-expressions (which, by the way, lead naturally into monads)
- Domain modeling with Scala/FP
- An introduction to type classes (and why they exist)
- Visual lessons on collections’ methods like `fold` and `reduce`
- Much, much more ...
The book is organized into small, single-purpose lessons that flow in a logical order. You’ll see how one concept naturally leads to the next concept, and that concept leads to another one, and so on.
Sorry, I don’t have a free preview available for this book yet because I’ve only just started the editing and rewriting process. But because the style will be the same as the previous book, you can get a good feel for what it will be like by checking out this 400-page free preview of the previous book:
I’ll be glad to provide a preview of this book as soon as I update enough lessons for it!
Prefer A Smaller Book?
The PDF version of this book will probably end up being about 1,000 pages long. If you prefer a much smaller book, check out Learn Functional Programming Without Fear, another FP book for beginners that’s only 250 pages long.
All the best,