I know this is an old book (1994!), but it’s one that I have just added to my bookshelf and it’s worth a review for undergraduate (read: relatively inexperienced) programmers such as myself. Written by the now famous “Gang of Four” (Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides), Design Patterns is the classic and authoritative reference on the subject.
So far I am a self-taught programmer with intermediate experience, but I am looking forward to taking classes in my major and improving the quality of the code I write as early as possible. Design patterns are a significant part of it, and this book is a great place to start. Separated into two parts — a case study and a reference section — this is a book that will be useful both now and in the future. While the patterns presented are not new by any means (in fact, they weren’t new at the time when the book was written), with today’s shift towards object-oriented programming languages (Java, C#, etc.), the basic 18 patterns that it presents are more crucial than ever to have a working knowledge of.
If you are interested in creating properly abstracted and decoupled classes; wish to learn about patterns useful for allowing undo/redo operations and state saving, patterns that help you manage object creation or access, and much more, then you will find this book to be useful. As I read through the scenarios I find myself thinking back to code that I have written, wishing I had read the book earlier! In all, the patterns the book describes are Abstract Factory, Builder, Factory Method, Prototype, Singleton, Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy, Chain of Responsibility, Command, Interpreter , Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, and Visitor. For each pattern there is a brief and long description, a list of implementation tips to consider when using the pattern, and a concrete example in C++ (mostly) or Smalltalk.
The only con that I have found so far is that the code samples are fairly specific and leave me wanting more as a tangible explanation of the conceptual description for each pattern. For that reason, a great book to go along side this one — or perhaps to start with – is Design Patterns in Java by Steven Metsker and William Wake, as it has more examples and included problems and solutions for each pattern. Overall, though, Design Patterns is a must-have for serious programmers.
Design Patterns: Elements of Reusable Software on Amazon.com