Å·±¦ÓéÀÖ

Jump to ratings and reviews
Rate this book

Grokking Functional Programming

Rate this book
There’s no need to fear going functional! This friendly, lively, and engaging guide is perfect for any perplexed programmer. It lays out the principles of functional programming in a simple and concise way that will help you grok what FP is really all about.

Grokking Functional Programming introduces functional programming to imperative developers. You’ll start with small, comfortable coding tasks that expose basic concepts like writing pure functions and working with immutable data. Along the way, you’ll learn how to write code that eliminates common bugs caused by complex distributed state. You’ll also explore the FP approach to IO, concurrency, and data streaming. By the time you finish, you’ll be writing clean functional code that’s easy to understand, test, and maintain.

520 pages, Paperback

Published September 27, 2022

29 people are currently reading
489 people want to read

About the author

Michał Płachta

1Ìýbook16Ìýfollowers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
39 (68%)
4 stars
15 (26%)
3 stars
3 (5%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 12 of 12 reviews
Profile Image for Hafiz Hussain.
88 reviews9 followers
January 12, 2024
V2: I have read the complete book and my V1 review still holds :)

V1:
This book is not complete. When I read this book, it has seven chapters complete, and eight chapters are still in progress. My review is for the first seven chapters.
I read different books on Functional Programming, and my background is from OOP. I have been working since 2012 in C++, Java, Kotlin, and some other languages, OOP.

Grokking Functional Programming is a beautiful and fantastic book. This book is more like a good teacher who knows about his students and how to teach them. Most books teach us what functional programming is which is also essential. Instead, we can discuss what you expect from a functional programming book. In my opinion that should discuss:
1. pure functions.
2. functions as arguments
3. higher-order functions
4. return type as functions
5. function is a type like other primitive types
6. map
7. filter
8. fold
9. reduce
10. flat map
11. Optional Data type
12. Either Data type
13. ADT (Abstract Data Types)
14. Functor
15. Currying

This book also has all these terms, but the unique thing is, this book first shows you the OOP solution and then the problems in that solution, and after that, this will refactor to FP. In this way, the reader can apply these concepts to his daily job.
Waiting for the remaining chapters, I will read again this book.
Thank you, the Author, and all his team members who are writing this fantastic book.
1 review
November 15, 2022
If you want to get started with functional programming this book is for you! Well written, very easy to understand even more complex concept. Strongly recommend.
Profile Image for Maciej Mróz.
3 reviews
January 29, 2023
I always enjoy reading programming books as it's almost impossible to read a good book and not learn something new, even if you are experienced software engineer. This book specifically was a great reminder on the "why" of functional programming and how did we get where we are today.
It uses Scala to demonstrate the principles at play but Scala here is a tool rather than the subject. Author takes a lot of care to not jump into very advanced FP concepts but rather tries to build on top of common knowledge brought from other programming languages (with Java being very often used as a reference). Starting out with basic concepts like immutable data, pure vs impure functions, higher order functions and ADTs, book moves quickly to programming with effects, functional streams and testing applications that use these. It shows the reader how to use functional programming in a setting closer to real world, all while creating coherent and logical story that does not introduce too much at once to not overwhelm the reader.
That leaves the question: who is this book for? I believe it is best for people who do have at least some programming experience with imperative languages (like Java, C#, even C++) but are curious or on the fence about functional programming. If you heard about functional programming and think "Ok, there's a lot of hype, but really, what's in it for me?" - that book may answer this question ;) I smiled a few times reading about possible problems in imperative code bases and how changing the approach to more declarative one eliminates them because I've seen them in one form or another during my own programming practice.
I don't think it's good book for absolute beginners although should still be approachable with a bit extra effort. It definitely sets up the right starting point and good defaults for someone who wants to make a jump to Scala and FP. While real world code bases usually require a lot more knowledge to than presented in this book, they also do not stray far from principles presented here, rather building on top of them than using something completely different.
Does that book bring much to the table to experienced developers who already work on FP code bases daily? Maybe. Working in that space professionally for quite a few years I still found it nice to read. Made me reflect a bit on the history of FP in Scala and how much it matured over the years. This book might also serve as good inspiration on how to teach these concepts to newcomers. Let's face it: it is a different world, and bringing new people in is not an easy task. Yes, eventually people have to be exposed to concepts like functors, applicatives, monads, monad transformers, free monads etc etc This book proves it is possible to get very far with just showing practical benefits of approaching everyday problems in our discipline from different angle, without scaring people off.

Disclaimer: I know author personally, and got a free review copy. I was asked to do an honest review, and it is
Profile Image for Zbyszek Sokolowski.
291 reviews16 followers
January 28, 2023
I am still reading the book however I see even now that I am really satisfied with the content. This is next book about functional programming however it is better, than many other which I read so far. And believe me that I was reading a lot of them. This book is really different, author Michał Płachta made a great job and wrote a book which teaches FP basics from scratch and has great educational attitude towards students, readers. It teaches FP concepts in very nice way, audience is Java programmer who has experience with OOP, maybe with Java Streams and he is presented with small, overthought challenges. How to write concise, short apps, APIs, without mutating state and elegant way. The book contrary to many others have very low and slow entry level and it teaches all FP but step by step. I enjoy this approach a lot. The book starts from comparison between imperative Java and Scala. At first I thought that oh no next book related to Scala. Nevertheless, Scala code presented in book is quite simple and easy to understand. What is the most important is knowledge which is important in any language. I am sure that even if a developer still will be write in Java with Streams or reactive programming his/her code became better many mechanism will remain the same. And reader will at last really understand how to write correct, effective functional code. Every chapter contains small lessons to train new learned skills. All in all I recommend the book to other fellow developers with really clear conscience. And I will finish it ASAP just because it is worth of it. :)
14 reviews
January 29, 2024
Excellent. If you would like to read book on functional programming this must be the first choice.

Perfectly explained, understandable, each step perfectly reasonable and explained. The best.

One small disadvantage for me is using CatsEffect instead of ZIO.
Profile Image for Karol Pasierb.
39 reviews13 followers
December 12, 2021
This is a great book. It really helped me a lot. It's a shame that's a MEAP as it took so long to read it and it was soooooo stretched. Perhaps MEAP is a good idea, but it doesn't suit me well enough.

Putting that aside, I was loosing focus with the final chapters. Perhaps topic didn't fit with me well, or it was a bit too rushed. I'd say, the "problem" is in me.
Overall, absolutely great book, that is really well explained. I was reading that in conjunction with Grokking Simplicity and I think they complement each other very well.
Definitely recommended.
Profile Image for Maximiliano Curia.
33 reviews1 follower
January 28, 2023
Very good book, lots of concepts nicely explained and, it also made me realize I really don't like scala. :)
Profile Image for Przemysław Pokrywka.
1 review
March 26, 2024
"Grokking Functional Programming" is the book I (and many of my Java developer colleagues) would find eye-opening at the time when we considered ourselves experienced developers, already familiar with the frameworks and best practices of the Java world. You can only feel the pain of your current approach when you are exposed to something much better. Functional programming can indeed seem weird and confusing initially, especially when you get confronted with a set of concepts, that come from some obscure sub-fields of mathematics, rarely known to a layman. Also, its focus on simplicity can give a developer a feeling of uneasiness: no exceptions? No runtime reflection? No nulls? Why should I resign from these powerful constructs, is it some form of secular ascesis? These are the questions "Grokking FP" answers in the best possible way. It (gently) drives you from a typical imperative solution to a functional one, allowing you to see all the benefits you were missing initially, with all the associated risks and drawbacks that are sometimes taboo among developers, who simply don't know better. It lets you realize, how much easier is to comprehend the code when it's written in the functional style, and how much human memory resources are saved when you only need to deal with the complexity of the problem and not with the accidental intricacies introduced by imperfect tools. Learning it has transformed many software developer careers already (myself included), and "Grokking FP" is a perfect way to do it.

What I liked in particular, is how much the code can improve by applying the techniques of functional programming. They are presented at a comfortable pace, not overwhelming the reader with everything at once. In every section, you find summaries of the differences between the imperative and functional solution (very tasty for me, often felt like a smackdown of the imperative code). Numerous illustrations help to convey the concepts. Also, the author managed to avoid bringing in the scary-sounding category-theory nomenclature, while getting the point across.

The code examples are mostly in Java (imperative) and Scala (functional), but some examples are from other languages, to illustrate, that these concepts apply to many environments, and you don't need to use Scala (although it might work great for you) to achieve the numerous benefits of FP.

If you develop software but haven't grokked FP yet, I heartily recommend reading this book.
9 reviews
March 3, 2025
It's a very good book that explains the strengths of FP in a nice way, but as the chapters go on, the book tends to focus on Scala to the exclusion of Java. For programmers familiar with OOP, the functional implementation of Java code is a better way to communicate in their language. The idea that implementing FP in C++ from Scala is quite a challenge made me want to stop reading the book and look for some C++ FP books.

After chapter 6, the code provided as a lesson is so convoluted that it's hard to follow. The book is intended to be maintainable and readable, but ironically the code in the book is very hard to read and use, with many topics in each chapter combined into one (500+ lines) and a lot of unhelpful comments and tests.

If you read 2/3 of chapter 7 and need to read the other 1/3 the next day, all the function declarations and implementations written in console in the past will have been volatilized, so you need to load them by referencing the code. But when the code is that complex, it's hard to load.


Below are my suggestions to make it a better book.

1. the code in the chapter should be split into new files whenever a new Scala function or a function that implements some requirement is created. The split files should show the entire code accumulated as the chapter progresses, so that learners can alternate between the book and the code to see how the requirements are improved in a FP fashion.

2. The exercises should be available in a text editor like VS Code. REPL sessions are just ridiculous because they are volatile and it kills the motivation to do the coffee breaks and exercises. In my experience, the sbt console works well up to chapter 6, but not beyond.
1 review
November 11, 2022

I'll preface this short review by saying that I'm still relatively new to the world of functional programming and have found some other very well regarded texts around the topic quite challenging to consume. Nevertheless my enthusiasm for the subject has never waned so the hunt for the perfect introduction to FP continued on.

I'm about half way through the book currently and I have found it exceptionally approachable, I've found the writing style very engaging and so far this is shaping up to be the book that I recommend first when friends and collegues express an interest in getting in to FP.

I will post a more in detail review once i've completed it.
Profile Image for U. P..
14 reviews
May 30, 2023
This book is a very good start for Functional Programmers wannabe! Well written, very easy to understand. It explains hard concepts in a very compelling way! Strongly recommend.
Displaying 1 - 12 of 12 reviews

Can't find what you're looking for?

Get help and learn more about the design.