Categories
book review design patterns

Book Review: Head First Design Patterns

Head First Design Patterns by Eric and Elisabeth Freeman is a fun read. I always was curious about what kind of content some of these books by O’Reilly that seemed so different would be like (lots of pictures, jokes, crossword puzzles etc.) but it turned out to be both entertaining and informative. The book really does try to tackle a number of important issues, and doing an “arm chair discussion” where two design patterns talk (and argue) about their differences, is both funny and some of the most useful insights into distinguishing patterns I have seen.

The Freemans really do create a useful intro to design patterns, with a number of entertaining examples that will make you enjoy reading each page, and is certainly a breath of fresh air for anyone used to very academic and “serious” books. I felt the content was great, and the format was excellent for an introduction book.

While I don’t normally go for books based on Java, this was more of a theory book, and while the source code examples are in Java, it should not be difficult for anyone to follow along (outside of maybe some of the Remote Proxy examples which leverage Java’s Remote Method Invocation).

The main patterns covered include: Strategy, Observer, Decorator, Factory, Singleton, Command, Adapter, Facade, Template, Iterator, Composite, State, Proxy and Compound Patterns. There is also an appendix that contains a number of other patterns. I would have prefered to have seen a chapter on Flyweight or Builder instead of Singleton, but whether or not Singleton is an Anti-Pattern is still up for debate.

One of the most interesting approaches in the book is to break apart a Model-View-Controller paradigm into separate patterns. The Model becomes and Observer pattern (allowing state information to be passed back to the View or the Controller (allowing it to be independent of the View and Controller). The View becomes a Composite (likely a collection of widgets or something similar). The Controller implements the Strategy pattern, which configures the View with a strategy and changes the state of the Model as necessary. This explanation fits well (especially the Model using an Observer) which I think is one of the nicest ways to implement the MVC design.

While I have read a few books on Design Patterns already, I think as an intro, unless you are looking for a specific language implementation or the original Design Patterns book by the Group of Four, I think this is a good intro and an overall fun read.

Bye for now,
Michael Hubbard

About Michael

Leave a Reply

Your email address will not be published.