Design Patterns: Elements of Reusable Object-Oriented Software

Book Cover

Design Patterns: Elements of Reusable Object-Oriented Software is the one reference when it comes to Design Patterns. First published in 1994, the book is now at it’s 30th printing. The nearly 400 fine printed pages masterpiece has a retail price of 85.99$ CAD, but you can have your copy from Amazon.ca for 43$ CAD. The four authors of the book are often refered to as the Gang of Four and their standing was high enough even back when the book was released. The last paragraph from the back cover should be descriptive enough:

The authors are internationally recognized experts in the object-oriented software field. Dr. Erich Gamma is a technical director at the Software Technology Center of Object Technology International in Zurich, Switzerland. Dr. Richard Helm is a member of the Object Technology Practice Group in the IBM Consulting Group in Sydney, Australia. Dr. Ralph Johnson is a faculty member at the University of Illinois at Urbana-Champaign’s Computer Science Department. Dr. John Vlissides conducts his research at IBM’s Thomas J. Watson Research Center in Hawthorne, New York.

The rest of the review contains a description of the content of the book, which is divided in two large sections: an example case study and the pattern catalog. Of course, I will also give my opinion since it’s what this review (and blog) is all about.

First off, the introduction explains how the book is separated, what the motivations were in writing the book and how they classified the patterns. It also gives a quick overview of everything they expect the readers to know before the starting to read. The introduction itself is quite interesting and give a good overview of what’s covered. Alone, it stands for around 30 pages.

The example case study takes an example applications and explains how each problem can be solved by applying a pattern. During the process, a brief description of the patterns are given and a reference to the catalog is made. I’m not too sure it was a good decision to place it ahead of the catalog itself as most patterns it refers to are unknown at the moment of the reading. I would recommand skipping to the catalog and coming back for the example afterwards if you already know a little about the entire point of using patterns. The example covers a word processor, which I have to admit, is poorly adapted to 2005, but the design decisions being made and the way they are explained is still great. The case study really demonstrate how multiple patterns interact.

The catalog really is the heart of the book and should be the reason why you buy it. A total of 23 patterns are being covered and each has over 10 pages dedicated to it. They are divided in the, now usual, categories: Creational, Structural and Behavioral. Patterns are listed alphabetically within their categories, which is great since the authors did not try to judge their complexity or influence the readers into using certain patterns. Pattern descriptions always refer to other patterns, which could be located further. The book was built as a reference, keep it in mind.

Every pattern follows the same structure: brief description, synonyms (AKAs), example context, applicability rules, general structure, participant names and roles, collaborations, consequences, implementation, code samples, real world uses and related patterns. In order to reduce the amount of descriptions I have to write, I used more intuitive titles so I can really write about the important stuff.

The structure and collaborations are represented with some sort of primitive UML class diagrams and sequence diagrams. In fact, they are very easy to understand and are supported with enough text to be understood.

The consequence section really is one of the strongest parts of the catalog. It does not only tell why it’s good, it also explains how it will influence the application and what problems it will solve or which ones can be caused. In several cases, references to other similar patterns that would offer a better solution are offered. The implementation section lists the variants of the patterns and detail multiple ways it could be enhanced for the particular situations. Once again, an accent it placed on the trade-offs and decisions that have to be made. Most other pattern books and articles show each pattern as a one true way. Sadly, their one true way is often taken from this book and only considers the base skeleton of the pattern.

The code samples are always in C++ and once in a while, a SmallTalk example. Luckly, there is never a SmallTalk example alone because I really don’t understand that language at all! The code examples are always very short and only show what’s really important. Don’t expect it to be a cookbook. Examples are not complete, they only show the base implementation details. I consider short examples as a positive aspect as they leave more space for what’s really important. Design Patterns are about concepts, not code.

The known uses can be hillarous at some points. You have to keep in mind the book was written over a decade ago. Basically, the examples were taken before the book was published. Forget references to Microsoft products or the Java API. Nothing about Python, no QT, no GTK. Ever heard of ET++, InterViews, ObjectWorks, NeXT’s AppKit or ObjectWindows? (Just to name a few) The Known Uses section might not be the most useful read, but it still show some places where it has been used along with the kind of variants that were used and the contexts, which can give ideas for some applications.

Overall, this book is probably the book any software engineer should own. You still have a bible next to your bed? It might be time for a replacement. It’s probably even worth adding for furniture just to hold it. I give it a straight 5/5 (and I still feel it’s under-rated) for being the most complete reference available about Design Patterns, even a decade later. In the conclusion, the authors open door to the community to catalog even more patterns. I think a pretty bad job has been done ever since. Every catalog I’ve seen only explain what has already been explained the book referenced to as [GoF94].

Leave a Reply

Your email address will not be published.