Jump to ratings and reviews
Rate this book

Scala Design Patterns: Patterns for Practical Reuse and Design

Rate this book
Scala is a new and exciting programming language that is a hybrid between object oriented languages such as Java and functional languages such as Haskell. As such it has its own programming idioms and development styles. Scala Design Patterns looks at how code reuse can be successfully achieved in Scala. A major aspect of this is the reinterpretation of the original Gang of Four design patterns in terms of Scala and its language structures (that is the use of Traits, Classes, Objects and Functions). It includes an exploration of functional design patterns and considers how these can be interpreted in Scala's uniquely hybrid style. A key aspect of the book is the many code examples that accompany each design pattern, allowing the reader to understand not just the design pattern but also to explore powerful and flexible Scala language features. Including numerous source code examples, this book will be of value to professionals and practitioners working in the field of software engineering.

349 pages, Hardcover

First published November 24, 2013

27 people are currently reading
2876 people want to read

About the author

John Hunt

14 books2 followers
Librarian Note: There is more than one author in the Goodreads database with this name.

John Hunt (1964), Software specialist.

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
2 (25%)
4 stars
2 (25%)
3 stars
0 (0%)
2 stars
1 (12%)
1 star
3 (37%)
Displaying 1 of 1 review
Profile Image for Rod Hilton.
152 reviews3,116 followers
February 5, 2018
I found this book kind of a struggle to get through. It didn't read like a lot of other patterns books, in which it often feels like an expert is presenting patterns and you sort of wonder if the authors are the people who designed or came up with the patterns, but more like a nonexpert that is trying to catalogue patterns they are seeing for their own notetaking purposes. It feels kind of like a student Literature Review paper in a way, nothing ever really coalesces into a coherent educational book. It's hard to explain I guess, but suffice it to say that this book didn't really "work" for me.

It's got many issues throughout, a handful of grammatical mistakes, and technical issues ranging from misleading or confusing to outright incorrect. The example code is often a bit too short, it never really "illustrates" the point of a particular pattern, but instead seems to just be the bare minimum amount of code to implement a pattern and move on. Every section of each pattern just seems to be as terse as possible, almost like the author was unsure of what he was saying, and didn't want to risk being incorrect by saying any more than was strictly necessary.

The book's strongest section was its last, on Functional Patterns. This section was good but also contained some incorrect statements. One thing I found particularly odd is the mathematical approach to discussing these functional patterns (despite simple mathematical mistakes like incorrectly defining associativity) - it never really creates the bridge between academic functional programming and Scala. As a simple example, the author builds up definitions of Functor, Applicative Functor, and Monoid, then illustrates how a Monad is the combining of those three things. This is a common explanation/definition for a Monad within the world of pure functional programming - but Scala's author defines a Monad as anything that defines map() and flatMap(). I think it would have been nice to show how these definitions of Monad actually mean the same thing, illustrating how the methods can all be generically defined by relying on those, but the book never creates that bridge. Even the names of functions used like 'fmap' and 'join' are a bit strange - the entire book uses Scala but Scala's version of 'fmap' is typically just called 'map'. It's almost like somewhere out there there is a Haskell book called 'Haskell Design Patterns' which is character-for-character the same book, but then the author realized the book might get more eyes if he just changed all the code examples to be Scala and otherwise changed nothing else.

Compare this to the classic "red book" Functional Programming in Scala by Bjarnason and Chiusano, which covers similar material but is so perfectly in harmony with the Scala language itself that a good portion of the book is rebuilding a number of components in the standard library from scratch.

The weakest section of the book is by far the Gang of Four Design Patterns section, in which all of the classic GoF patterns are covered, but not really in a way that takes advantage of the fact that Scala is a functional programming language. Like rather than each pattern being something akin to "the purpose of this pattern in an OO language is this, so we can accomplish the same thing by doing that in a functional language", they're just straighforward GoF implementations in Scala. In other words, they're the kind of code you see when a Java programmer just translates working Java code directly into Scala without regard for FP as a paradigm.

The only other section worth mentioning is the Code Reuse Patterns section which is often decent, but contains coverage of 3 patterns for dependency inversion that were covered in just the briefest, most cursory way imaginable. Once again, it almost felt like it was being sped through so as to not make any additional mistakes, as if it was written by someone that didn't really feel confident in the material and didn't want anyone to notice.

Overall this book doesn't feel like it was meant to be read by someone looking to learn anything. It seems like a student's semester project that was published by Springer without being copyedited. Like someone's personal Wiki page got printed out. It feels very minimal effort, not like the kind of book an author writes with their audience in mind and a goal of educating. There are some other patterns books, like the aforementioned red book (not strictly a "patterns book") or Functional Programming Patterns in Scala and Clojure by Bevilacqua-Linn, which are vastly better ways to spend time.

I think the Scala programming community is desperate for a fantastic patterns book on functional patterns using the language but so far every book I've found falls a bit short. Of them, this one falls the shortest. Skip it.
Displaying 1 of 1 review

Can't find what you're looking for?

Get help and learn more about the design.