Book review: Design patterns: Elements of Reusable Object-Oriented Software

As I’ve said before, I’ve done several book reviews in the past. I will start with a small serie on design patterns books.

This book is one of the “must-have” in your library. If you write some code or if you manage some IT or Computer Science projects, you will have this book to lay down the basic software architecture.

Content and opinions

The first two chapters are an introduction and explain the reasons of the existence of design patterns, how they should be used, good and bad pratices, … Design patterns without rules to apply them are useless (as the original architectural patterns are useless without drawings skills). A practical example is the object of the second chapter.

Design patterns are exposed in a three parts catalog. Each pattern each described by a complete explanation, an UML diagram, the interactions between the pattern elements, as well as some implementation solutions (all solutions cannot be written, as it is language-dependent).

Creational patterns are about creating new objects. They include the abstract factory (constructing several objects of different kinds), the builder (a more elaborate constructor), the factory method (overloading a class method to create objects based on different classes), the prototype (creating new objects by cloning an instance) and the singleton (creating only one instance of a given class).

Structural patterns are more about the actual software architecture. They include the adapter (translating an interface to another one), the bridge (separating an interface from different implementations), the composite (allowing several objects of a hierarchy to be composed together), the decorator (adding characteristics to an object), the facade (offering an interface to several classes), the flyweight (sharing the same objects between instances so as to reduce memory overhead) or the proxy (using another object to access another, potentially hidden, one).

Behavioral patterns enable a software to change its own behavior. They include the chain of responsibility (allowing processing requests by whoever can), the command (creating complex requests), the interpreter (describing how a language can be processed), the iterator (providing a way of browing the content of a data container), the mediator (allowing communication between different classes), the memento (enabling restoring the state of an object), the observer (sometimes also called listener, creating a way for instances to be updated/called by another one), the state (allowing changing behavior on the fly), the strategy (providing several ways of doing something), the template method (providing a skeletton for an algorithm) or the visitor (allowing execution of code for every the content of an object). This patterns set is perhaps the most heterogeneous one (although the state and the strategy are in fact exactly the same, the only difference being the interpretation of their actions).

Conclusion

This book, sometimes refered ad the GoF book, lays down the basis of software conception. These 23 patterns are not the only ones you may use (some of them are also seldom used), but they are used to make the more complicated ones. If you have one design patterns book you should buy, it is this one.

One thought on “Book review: Design patterns: Elements of Reusable Object-Oriented Software”

Leave a Reply