It is hard enough to remember my opinions, without also remembering my reasons for them! 👻
~ Nietzsche, as quoted in Moore’s and Mertens’ The Nature of Computation (Oxford).
I have no doubt in my mind that Scala is extremely well-positioned to serve as a bridge between the object-orientation of Java and the functional programming languages. My journey began several years ago with a highly readable book called Seven Languages in Seven Weeks: A Pragmatic Guide to Learning Programming Languages (O’Reilly) by Austin-based Bruce Tate. And in case anyone wondered where the name “Scala” came from: “Scala” is the Italian word for stairway 👞 👡 👣 👢
Casting a glance back at my (ongoing) journey, here are the books that have proved most helpful to me in grokking Scala—I’ll take an opinionated look at the following books, in turn
- Programming Scala: Scalability = Functional Programming + Objects (O’Reilly), by Dean Wampler and Alex Payne ⛳
- Scala in Action (Manning) by Nilanjan Raychaudhuri 🚁
- Scala Cookbook: Recipes for Object-Oriented and Functional Programming (O’Reilly) by Alvin Alexander 🍔
- Scala in Depth (Manning) by Joshua Suereth 🏊
- Functional Programming in Scala (Manning), by Paul Chiusano and Rúnar Bjarnason 📐
- Scala for the Impatient (Addison-Wesley), by Cay S. Horstmann ⏳
1. Programming Scala: Scalability = Functional Programming + Objects (O’Reilly), by Dean Wampler and Alex Payne ⛳
If you’re going to read only one book on Scala, make it this one: Programming Scala: Scalability = Functional Programming + Objects (O’Reilly), by Dean Wampler and Alex Payne. It has been said about Scala—and very correctly so—that it has a very large surface area. In their book The Well-Grounded Java Developer, Evans and Verburg define it like so:
The surface area of a language is the number of keywords and independent language constructs that the working developer must master to be productive in the language.
2. Scala in Action (Manning) by Nilanjan Raychaudhuri 🚁
The book Scala in Action (Manning) by Nilanjan Raychaudhuri is another excellent book which has aged nicely over the years that I’ve programmed in Scala, and as my experience with it has grown. It’s target audience is clearly the enterprise software developer who is typically working with a massive code-base. While this book isn’t nearly as comprehensive a guide to Scala the language, it definitely has its strong points. One thing I really appreciated was how the author introduces each chapter with an engaging prelude; with the captivating motivational material to grab you up-front, the ensuing narratives in the chapters each flow smoothly, and the chapter-to-chapter transition is pleasing and smooth as well.
Another quality of this book that I appreciated a lot are the copious footnotes, containing pointers to useful references for the reader to explore (The quality of these references is especially high, much more so than I typically find in other books—Kudos to the author for painstakingly researching and then culling the research to share only the very best references).
This book is particularly good for those transitioning from Java to Scala. James Gosling (the renowned designer of the Java programming language) has said
If I were to pick a language to use today other than Java, it would be Scala.
If that description fits you, then this Scala in Action the book for you. I found it especially strong in its coverage of the inevitable topic that’s highly relevant for seasoned Java programmers—interoperability between Scala and Java. I liked the author’s take on working with Java generics and collections, on solving integration challenges, plus a nice bonus on building web applications in Scala while using Java frameworks.
3. Scala Cookbook: Recipes for Object-Oriented and Functional Programming (O’Reilly) by Alvin Alexander 🍔
The programming cookbooks are perennial favorites with many of us software developers. This one, entitled Scala Cookbook: Recipes for Object-Oriented and Functional Programming (O’Reilly) by Alvin Alexander follows in the fine tradition of the legendary programming cookbooks published by O’Reilly. Probably the first thing you will note is this book’s size! Coming in at 722 pages, it’s quite the boat anchor, and not for the faint of heart 😉
Joking aside, I think highly of this book from a fellow Aggie. Think of this tome as high octane fuel to propel your programming adventures in Scala. It is replete with all things common sense and pragmatic about doing things the Scala way.
What I appreciate the most about this book is its relentless focus on serving the reader with recipe after recipe of high-quality code—undoubtedly coming straight from the trenches of software development in Scala—accompanied by insights into the why and wherefore of the rationale taken by any given recipe. If pragmatic, no-nonsense advice (on nuts-and-bolts Scala programming) is what you’re after, this is the book for you. My first taste for the pragmatism that the author brings to the pages of this book came with this delightful self-introduction. Thus, while introducing his circuitous route to software development (after getting a degree in Aerospace Engineering from Texas A& M University), the author says
…Once he became a practicing engineer, he realized he liked software and programming more than engineering. So in approximate order he taught himself Fortran, C, Unix and network administration, sed, awk, Perl, Java, Python, Ruby, JRuby, Groovy, PHP, and Scala. During this process he started a software consulting firm, grew it to fifteen people, sold it, and moved to Alaska for a few years…
In a nutshell—much as the author himself notes in the Preface—this book is
…a cookbook of problem-solving recipes about Scala, the most interesting programming language I’ve ever used. The book contains solutions to more than 250 common problems, shown with possibly more than 700 examples. (I haven’t counted, but I suspect that’s true.)
4. Scala in Depth (Manning) by Joshua Suereth 🏊
I’ve got a confession to make: This next book that I am about to recommend, I do so with a tad bit of trepidation, because it has challenged and stretched to its limits—and continues to do so—my conceptualization of the expansive solution space spanned by the true Scala way of doing things…
This book, Scala in Depth (Manning) by Joshua Suereth, is the work of a programming virtuoso! Having made the confession above, I’m glad to have doggedly stuck to grokking the sublimely intricate themes to be found in its pages. While this is definitely not your first, or even second, book on Scala, please don’t let that deter you. Repeatedly trekking over and dipping into its pages—that’s what I’ve been doing the past several years—will be time supremely well invested. Once you’ve read a couple of books on Scala, experimented at the REPL to your heart’s content, and are writing some significant Scala code, this book will be your guide to some amazing things that this amazing language equips you with.
To use the notion of SNR—Signal-to-Noise Ratio, of which all engineers get disabused at one time or another during their training—this masterpiece has practically zero fluff. In my mind, this book will easily still be around for another decade, serving as a rich source of insights into Scala, for developers like us to mine and benefit from. It’s rather difficult to convey the richness of topics covered quite thoroughly in this fantastic compendium of relatively advanced themes in the Scala solution space. What will help convey that richness as a prelude are these words of the stunningly brilliant and creative computer scientist, Martin Odersky—designer of the Scala language—which he offers in the book’s Preface:
Joshua Suereth is one of the most complete programmers I know. Familiar with a whole gamut of programming languages and techniques, he is an expert in high-performance systems, build tools, type theory, and many other areas. He is also a gifted teacher, and all that combined is what makes Scala in Depth special.
This book provides in-depth coverage of several of the more intricate areas of Scala, including advanced aspects of its type system, implicits, composition techniques with traits, collections, actors, functional categories. But this is not a dry recollection of language and library concepts. The book is full of practical advice on how to apply these lesser known parts of Scala in useful ways, and what the best practices are…
If what you’re looking for is expert guidance on how to write idiomatic Scala code and understand trade-offs when making use of advanced language features, you will like this book immensely. The type system in Scala is covered exceptionally well, as are patterns in functional programming (ala Scala), and you can’t help but appreciate the author’s unique take of promoting “…the blended style of Scala, where paradigms are mixed to achieve something greater”. As the author himself notes
Scala provides the tools needed to blend the object-oriented and functional programming worlds. Scala is at its best when these two evenly share a codebase. The biggest danger to misusing Scala is to ignore its object orientation or its functional programming. But combining the two is the sweet spot that the language was designed to fulfill.
5. Functional Programming in Scala (Manning), by Paul Chiusano and Rúnar Bjarnason 📐
I found a gem of a book in this next title: Functional Programming in Scala (Manning), by Paul Chiusano and Rúnar Bjarnason. This book provided the perfect answer to a vexing question that had been dogging me for a while—In the words of Scala’s creator, Martin Odersky, who has articulated that exact question so articulately as follows, in his Foreword to this book
So to properly learn functional programming in Scala, should one make a detour via a pure functional language such as Haskell?
So I got started a bit with Haskell—Got the GHC (Glasgow Haskell Compiler) and read parts of the book The Haskell Road to Logic, Maths and Programming (College Publications), by Kees Doets and Jan van Eijck. But I wasn’t sure—actually, still am not—whether I wanted to invest time in learning the rather alien-looking syntax of Haskell, let alone grok its idioms. Luckily for me, this book (Functional Programming in Scala) came along, and which I read via Manning’s MEAP (Manning Early Access Program). As Martin Odersky continues in his Preface, answering the vexing question that I alluded to earlier, he elaborates
Any argument in favor of this approach has been severely weakened by the appearance of Functional Programming in Scala… What Paul and Rúnar do, put simply, is treat Scala as a pure functional programming language. Mutable variables, exceptions, classical input/output, and all other traces of impurity are eliminated. If you wonder how one can write useful programs without any of these conveniences, you need to read the book. Building up from first principles and extending all the way to incremental input and output, they demonstrate that, indeed, one can express every concept using only pure functions. And they show that it is not only possible, but that it also leads to beautiful code and deep insights into the nature of computation.
Without a shadow of a doubt, this book is challenging—and I continue to work through it—but that challenge originates in the fundamentally different (functional) way in which it invites us to think about programming (i.e. contrasted with the pervasive object-oriented paradigm in which the vast majority of us swim nowadays). This is a book you likely won’t regret reading; to give you a sense of the topics covered, here is the Table of Contents:
1. Introduction to functional programmingChapter 1. What is functional programming? Chapter 2. Getting started with functional programming in Scala Chapter 3. Functional data structures Chapter 4. Handling errors without exceptions Chapter 5. Strictness and laziness Chapter 6. Purely functional state
2. Functional design and combinator libraries Chapter 7. Purely functional parallelism Chapter 8. Property-based testing Chapter 9. Parser combinators
3. Common structures in functional design Chapter 10. Monoids Chapter 11. Monads Chapter 12. Applicative and traversable functors
4. Effects and I/OChapter 13. External effects and I/O Chapter 14. Local effects and mutable state Chapter 15. Stream processing and incremental I/O
The bottom-line with this gem—Functional Programming in Scala—is that it will challenge you, and jolt you out of your comfort zone. But if you’re up to it, you’ll be richly rewarded.
6. Scala for the Impatient (Addison-Wesley), by Cay S. Horstmann ⏳
Although not in the same league as the preceding books, this book is especially good in covering the syntax of Scala both succinctly and comprehensively. I reckon the title says it all: Scala for the Impatient (Addison-Wesley), by Cay S. Horstmann. This book will be especially helpful for anyone coming brand new to Scala. When I read it, I was quite impressed by how the author had diligently crafted the material to help the reader—typically, someone coming from Java to Scala—bridge the chasm between the two languages.
It also contains lots of tips and tricks—common gotchas that trip up beginning Scala programmers. In fact, this quality, combined with its succinctness and comprehensiveness, makes it a good reference to have around. In the words of Martin Odersky
I am very happy that his book has finally arrived because it really delivers on what the title says. It gives an eminently practical introduction to Scala, explains what’s particular about it, how it differs from Java, how to overcome some common hurdles to learning it, and how to write good Scala code.
This books nicely addresses for beginners the essential challenge of Scala being a language with a very large surface area (and to which I had alluded earlier). In fact, much as the author himself notes in the book’s Preface
Scala is a big language, but you can use it effectively without knowing all of its details intimately.
With these caveats, Scala for the Impatient is definitely a book worth exploring.
In the end, and as I mentioned at the outset, I invite your comments—Having now read my brief take each on the books above…
- Do you find that your experience of reading any of these books was different?
- Perhaps some qualities that I did not cover are the ones that you found the most helpful as you learned Scala and its ecosystem.
- Did I leave out any of your favorite Scala book(s)?
- I’ve covered only a partial list of the Scala books that I’ve read, necessarily limited by the time available…
My hope is that these brief vignettes will help you in your journey to grokking Scala. Bon voyage, and I leave you with a photo of a pseudo-random section—which is clearly biased toward Scala material—of one of my bookshelves 😅
Looking at this post, I see my commenting on Haskell, saying that "…I wasn't sure whether I wanted to invest time in learning the rather alien-looking syntax of Haskell, let alone grok its idioms". To any Haskell aficionados out there, I can assure you of the high esteem in which I hold this ground-breaking language, which has done wonders in bringing functional programming to the masses by laying the groundwork on which others have built, and continue to build (Monads, anyone?). My one-and-only reason is the inevitable time constraints, which circumscribe my exploring Haskell. Maybe, one day… At any rate, I'll add to these sentiments the remarks by Guy Steele, the legendary programming polyglot, who has had a hand in the creation of both Common Lisp and Scheme, and whose work I greatly admire: "Haskell is a beautiful language. I love Haskell…" (From an interview given to Peter Seibel). Hey, what's good enough for Guy Steele is good enough for me 🙂
It felt good to see your article as I have all these books 😊is like to add akka in action by manning to your list
Thanks for your comment, Kayvan! Yes, Akka In Action (Manning) is also an excellent book, which I've read partially through MEAP (Manning Early Access Program) http://www.manning.com/roestenburg/. Sounds good, let's definitely add it to the list. In fact, how about I do a follow-up post with a review of a different set of Scala books?
There are definitely other Scala books that also offer much of value—the inevitable time constraints prevented me from reviewing those as well, in this post. So I confined myself to reviewing only the top Scala books that offer exceptional value. Some of the others that did not make the list for the aforesaid reason include these:
 "Akka In Action" (Manning), by Raymond Roestenburg et al (MEAP / Pre-order) is, as one of my readers commented, a book to keep an eye on. One thing that especially excites me about this book is that it's lavishly and profusely illustrated with helpful diagrams, flow-charts, annotated code, etc; needless to say, I'm a visual person 😉
As the authors of this fine book mention in their preamble, "While Akka is written in Scala, it is usable from both Scala and Java. It's primary goal is to make the achievement of performance, reliability, and scalability simpler. This is one of the most exciting aspects of Actors: they allow programmers to just focus on how to most efficiently implement solutions, not on having to make their code also manage scaling issues like batching or resource management."
If that's what you are looking for, this book is a rich mine of ideas on this topic!
 If you want Scala straight from the horse's mouth, as the proverbial saying goes, look no further than "Programming in Scala: A Comprehensive Step-by-Step Guide" (Artima), 2nd Edition , by Martin Odersky, Lex Spoon, and Bill Venners. The lead author of this book if of course the stunningly brilliant and creative computer scientist, Martin Odersky—designer of the Scala language. In my mind, Martin Odersky and Rich Hickey have, through their own unique contributions, rejuvenated and veritably set the programming world on fire. Based on everything that I've heard and read, both are incredibly gracious individuals, which is all the more awesome for the programming community.
Coming in at 852 pages, this book is not for the faint of heart 😉
But if you are really, really bent upon learning the nooks and crannies of Scala in all their glory, you simply can't go wrong with this book; I've read several portions of it, and it's good stuff.
 While this next book is not completely focused on Scala—it delves equally into other languages such as Clojure and Ruby—its coverage of idiomatic Scala in DSL design alone is worth the price of the book. This one is entitled "DSLs in Action" (Manning), by Debasish Ghosh. After introducing the goal of this book with these words ("If you want to design good APIs that are expressive enough for your domain users as well as for your fellow programmers, this book is for you"), the author goes on to elaborate that "This book addresses the issues of using a DSL as well as implementing one. It talks about a DSL as a thin veneer of linguistic abstraction on top of an underlying semantic model. The semantic model is the implementation that manages the core structure of the domain, while the language layer speaks the dialect of the domain user".
There are two full chapters on Scala-based DSLs: (1) "Internal DSL design in Scala" (covering the topics of: Scala as a language, Developing an internal DSL in Scala, Composing multiple DSLs, and Using monadic structures) and (2) "Designing External DSLs using Scala Parser Combinators" (covering the topics of: What are parser combinators, The Scala parser combinator library, Using packrat parsers, and Designing external DSLs using Scala parser combinators). All in all, this is a highly readable book.
Looks like my original comment did not make it due to technical problems.
I wanted to say thanks Akram for the great overview of these books. This does make me want to run to my local bookstore and grab one of these books (or two). My first look into functional programming was in college where we learned ML for a programming languages class. The book started off by saying there was no practical purpose for learning ML (e.g. you'd never use it in a real life job). That was not very motivational but I did enjoy learning about ML and the functional paradigm in general.
Of course that does beg the question of how marketable is Scala in the workplace? I suppose the old textbook warning that "you'll never use it in the workplace" has soured me because I'd love to be using a language like Scala everyday.
So what do you think? Do you think Scala is poised to become a contender with Java and C#? Or will it be relegated to a niche market?
Thanks for the detailed comment, Josh, as well as for your thought-provoking questions! I'm delighted that you, too, found this overview helpful—Trust me, I don't own stock in any publishing company, but if this overview got you motivated to run to your local bookstore and grab one of these books, then go for it 😉
Let me try to answer your questions, starting with the one where you wonder, "Do you think Scala is poised to become a contender with Java and C#? Or will it be relegated to a niche market?"
I find the case made by L. G. Meredith—for embracing the functional programming paradigm—especially compelling. Listen to what he has to say in a remarkable book entitled Monadic Design Patterns for the Web (Artima), currently in "PrePrint". He has extensive industry experience, including work (during his tenure at MCC) on Rosette/ESS, a fully reflective actor-based programming language with a high performance execution engine. Currently a managing partner of Biosimilarity (a software consultancy), Meredith boldly writes,
"Combined with the inherent simplicity of functional language design and its compositional nature, we have the making of a revolution in complexity management. This is the real dominating trend in the industry. Once Java was within 1.4 times the speed of C/C++, the game was over because Java significantly reduced application development complexity. This increased both productivity and manageability. Likewise, the complexity of Java has reached a point where an alternative that offers an advantage in terms significant complexity management techniques will eventually dominate….Here, we are not picking on Java, specifically. The same could be said of C# development, but Java development on Internet-based applications especially has become nearly prohibitive. Functional languages–especially languages like Scala that run on the JVM, have excellent interoperability with the extensive Java legacy, and have performance on par with Java–are poised to do to Java what Java did to C/C++".
While I agree with the gist of the preceding assessment, I would qualify it in that I see Java, which is the language in which I do my daytime programming (and to that, Meredith adds C#), continuing to maintain their strong presence in powering the software of the corporate world for another decade.
—Continuing here with my reply to the questions posed above by Josh—
Let's now move on to your other question where you ask, "Of course that does beg the question of how marketable is Scala in the workplace? I suppose the old textbook warning that you'll never use it in the workplace" has soured me because I'd love to be using a language like Scala everyday".
One Big Data project that I closely follow (Apache Spark) is written in Scala. Your namesake (Josh Wills, along with his co-authors) notes in his book Advanced Analytics with Spark (O'Reilly), that "…we think that learning how to work with Spark in the same language in which the underlying framework is written has a number of advantages…". For me, that's plenty good reason right there to feel grateful about having been hacking Scala (in my personal time) for several years now 🙂
But let's be pragmatic, and refer you to some more, down-to-earth, data such as that @ Dice on Scala Talent, and @Quora on Scala.
I hope this helps in some way to answer your questions. And I invite other readers to please share their thoughts on this topic…
BTW, the ML language—which of course didn't quite take the programming world by storm—is a good one to have learned, based on everything I've heard about it. My brand new copy of ML for the Working Programmer, Second Edition by L.C. Paulson (Cambridge) has been languishing on one of my bookshelves and has, so far, got merely a handful of hours' worth of reading time by yours truly 😉
Finally, let me leave you with these thoughts by Edward Garson, an independent software development consultant, as quoted in the O'Reilly book entitled 97 Things Every Programmer Should Know, and which is edited by Kevlin Henney:
"Mastery of the functional programming paradigm can greatly improve the quality of the code you write in other contexts (italicized by me for emphasis). If you deeply understand and apply the functional paradigm, your designs will exhibit a much higher degree of referential transparency".
"Referential transparency is a very desirable property: it implies that functions consistently yield the same results given the same input, irrespective of where and when they are invoked. That is, function evaluation depends less—ideally, not at all—on the side effects of mutable state".
Funny, isn't it, how we keep running into related things when we're thinking about any given theme? Case in point, and thinking here to the theme of a couple of programming languages that are less popular—though by no means lacking tons of expressive power, each in their own right—namely, Haskell and ML. So I pulled out of a bookshelf my copy each of the following two:
– Learn You a Haskell for Great Good!: A Beginner's Guide (by Miran Lipovaca)
– Purely Functional Data Structures (by Chris Okasaki)
And guess what I find in the pages of the latter (PFDS), which I had bought in England and that's been gathering dust for far too long? Literally tons of nicely annotated, functional code written primarily in ML (along with some Haskell translations of the ML snippets)… Nice 🙂
Tying this back to what one of my readers had commented on as follows:
"…My first look into functional programming was in college where we learned ML for a programming languages class. The book started off by saying there was no practical purpose for learning ML (e.g. you'd never use it in a real life job)".
Well, you've surely moved on to greener pastures than where ML could've probably led you, but here's your chance to knock yourself out—if you so wish—by having a look at a book that's replete with ML code.
BTW, I had totally forgotten just how entertaining the other book (Learn You a Haskell for Great Good!: A Beginner's Guide) really is—written with great gusto, and accompanied by a boatload of whimsical drawings, this book really draws you in, inexorably, into the vortex of the pure programming language, Haskell 🙂
Wow, this took me by surprise—I glanced at the statistics of visitors to this blog post and see that over 3,500 readers like you (and counting) have made the time to come read what I wrote. So thank you for your gracious time and interest!
And the way I want to thank you all—and others, who are graciously pouring in to check out my two-cents' worth—will be via a follow-up post. It'll also be on functional programming musings, but with a decidedly different twist… With that, I now have every intention of putting together such a post for you all to check out over the weekend that's right around the corner.
Again, this is a thank you note, that will be my way of saying, thank you!
Stay tuned 😉
Thanking each and every one of the twelve thousand-plus folks (12,073, to be precise, when I checked the stats a minute ago) who have dropped in to read this post!
@Akram – nice article – I am a beginner at scala and always enjoyed making some automation code in it. Thanks for sharing your thoughts.
– Thanks for the kind words, Sachin. Much as you noted, Scala is a versatile language, building on the tremendous ecosystem of Java. And I'm happy that you are enjoying creating automation code using Scala.
– To get more practice in this area, you may also want to take a look what I have recently reviewed, at an in-depth level: Best Reactive Programming Books Good luck, and please continue to share (here) your ongoing experiences with programming!
Thanks for sharing this blog post,Nice written skill Java online course
Great collection, thanks for sharing such a great information. Big Data Training in Pune
Its like you read my mind! You seem to know
a lot about this, like you wrote the book in it or something.
I think that you could do with a few pics to drive the message home a bit, but instead of that, this is wonderful blog.
A fantastic read. I'll definitely be back.