It is safe to say that “Functional Programming in Scala” by Chiusano and Bjarnason can be considered the most advanced Scala programming book published so far (in a sense, it can be compared to SICP.). Half of one of my bookshelves is occupied by Scala books, including Scala in Depth, but none of them takes the concept of functional programming as serious as this book, and pushes it to its limits that much. This, in turn, means that most of the Java programmers (including very senior ones), as well as Scala programmers with some experience should prepare themselves to feel very much like a newbie again.
But why the need for such a book, and what’s all that noise about functional programming? Here is my favorite description of functional programming given by Tony Morris : “Supposing a program composed of parts A, B, C, D, and a requirement for program of parts A, B, C, and E. The effort required to construct this program should be proportional to the size of E. The extent to which this is true is the extent to which one achieves the central thesis of Functional Programming. Identifying independent program parts requires very rigorous cognitive discipline and correct concept formation. This can be very (very) difficult after exposure to sloppy thinking habits. Composable programs are easier to reason about. We may (confidentally) determine program behaviour by determining the behaviour of sub-programs -> fewer bugs. Composable programs scale indefinitely, by composing more and more sub-programs. There is no distinction between a ‘small’ and a ‘large’ application; only ‘smaller than’ or ‘greater than’.”
The description above not only points at the core idea of functional programming and why that is important, as well as useful, but also draws attention to the fact that getting used to functional programming design can be difficult for people who are not used to thinking that way. Fortunately, “Functional Programming in Scala” is here to fill a huge void in that respect.
The book can be considered one of its kind, not only because of its strong logical foundations, starting from first principles and rigorously following them to their consequences, but also for its pedagogical approach. Even though it is aimed at practicing programmers and not academics, every chapter includes a lot of exercises arranged in a very nice developmental manner. But make no mistake, this also means that you cannot simply read that book, you can only study it. This, in turn, means that the only way to read the book is to run your favorite Scala coding environment, grab the exercises’ source code (and in case you are stuck, hints, as well as answers) from https://github.com/fpinscala/fpinscala, and start solving the exercise by implementing the required functions and other stubs. Moreover, you should do yourself a favor and also take into account the extra reading at https://github.com/fpinscala/fpinscala/wiki.
Depending on your level of Scala, e.g. if you have successfully completed the Coursera course titled “Functional Programming Principles in Scala” by Odersky, you can finish the first few chapters and exercises relatively quickly, but I would suggest to take your time after the first few chapters, 1-2 weeks per chapter will probably be an adequate pace for experienced programmers.
I can recommend this book to serious, curious, brave,and open-minded developers who target JVM by using Scala, and want less duplication, less boilerplate and much more powerful abstractions that are also easier to reason about, and who are ready to invest time to slowly digest the material by doing exercises instead of trying to quickly skim the text.