Book Review: Head First Design Patterns

Another review of an O'Reilly-ish book that I posted elsewhere, Head First Design Patterns by Freeman et al:

Oh sure, we've all got the Gang-Of-Four Design Patterns books on the shelf, right up there next to Knuth. I'd yank down my dusty copy whenever I needed to look up what a fellow coder meant by Facade or Visitor. (Actually, the short description of the patterns on the inside front cover usually was enough to fake my way through the rest of the conversation.)

In contrast, I charged through Head First Design Patterns in all of about two days. It was my first exposure to the breezy diagram- and photo-laden Head First series. You could consider the non-text portions to be just so much tree-killing fluff, but I found them a pleasant respite from what is, at heart, a pretty dry subject.

There were more than a few times during my reading that I sat back, whistled, and said aloud, "so that's how that works." The book covers the most common patterns from GoF in an incremental order. I was disappointed that some patterns were lumped in the last "Leftover Patterns" chapter because I would've enjoyed the authors' take on them, particularly the Flyweight pattern, a personal fave.

Examples are illustrated using Java. That's definitely an improvement over the templated C++ in GoF, but it does illustrate a failing: the old-school object-oriented languages like C++ and Java needed patterns to solve common problems. The latest batch of OO/functional languages like Python and Ruby have little use for some patterns, and add new patterns all their own. For instance, what use is there for an iterator pattern in Ruby that uses closures to loop? Why bother with factory patterns in languages with first-order functions and class objects?

That opinion aside, patterns are still an everyday matter for the OO practitioner, and Head First Design Patterns is a superb introduction to them.

This really was an enjoyable read. I even did some of the exercises at the end of each chapter.

Comments