This is distilled from my Charlotte Code Camp presentation yesterday.
The “Gang of Four” AKA “GoF”: Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides are authors of the code patterns reference book. The title is “Design Patterns - Elements of Reusable Object-Oriented Software”. This book is so standard, other books refer to pattern names with the page numbers from this book in parentheses like Singleton (127).
For legacy coders (Java, C#, C++, etc.), look at this one too:
C# Design Patterns – A Tutorial
James W. Cooper
Addison-Wesley ISBN 0-201-84453-2
If you’re using a more modern language like VB.Net, try this one. (For you legacy guys, this is VB humor. You laugh here. You do not flame):
Design Patterns in VB.Net – Building Adaptable Applications
Fischer, Slater, Stromquist and Wu
A!Press (was Wrox) ISBN 1-59059-274-3
If you want to see where it all started, read the book written about building architecture:
Timeless Way Of Building
Charles Alexander
You can learn from the GoF book, thanks to the most excellent work by Dr. Michael Mahemoff. The secret is to read “Design Patterns” in the right sequence:
|
Easy GoF Patterns |
|
Intermediate GoF Patterns |
|
|
Façade(185) |
|
|
Proxy(207) |
|
|
Singleton(127) |
|
|
Decorator(175) |
|
|
Mediator(273) |
|
|
|
like Proxy |
|
|
Iterator(257) |
|
|
Adaptor(139) |
|
|
Strategy(315) |
|
|
Bridge(151) |
|
|
Command(233) |
|
|
|
like Adaptor |
|
|
|
like Strategy |
|
|
Observer(293) |
|
|
Builder(97) |
|
|
|
|
|
|
|
like Strategy |
|
Advanced GoF Patterns |
|
|
State(305) |
|
|
Composite(163) |
|
|
|
like Strategy |
|
|
Interpreter(243) |
|
|
Template Method(325) |
|
|
|
like Composite |
|
|
|
alternative to Strategy |
|
|
Chain Of Responsibility(223) |
|
|
Factory Method(107) |
|
|
|
like Strategy |
|
|
|
like Template Method |
|
|
Abstract Factory(87) |
|
|
Memento(283) |
|
|
Flyweight(195) |
|
|
|
like Command |
|
|
Visitor(331) |
|
|
Prototype(117) |
|
|
|
|
If you’re reading to get a handle on patterns, it also helps to stay out of the weeds on your first pass. First read the “Intent” section. It will present a concise description of the problem and the solution. Take a quick look at the “Structure” session. It’s presented in OMT not UML. After all, this book was published in 1994. If the notation throws you, there’s an appendix in the book to explain it. You can also go to the outstanding Data & Object Factory site to see the 23 Gang of Four patterns in UML and C#. Finally flip back and study the “Motivation” topic. It explains what lead to the solution and how it helps. I find myself looking over the “Applicability” section too, since it discusses when to use the pattern.
Taking this approach to “Design Patterns” gets any competent professional up to speed by reading about 50 pages. When you’re in the trenches and recognize a need to apply a pattern, you can get down in the weeds and figure out how a particular pattern can help you.
In the meantime, your lunch time conversation gets a decided boost, assuming your lunch companion like code as much as you do.
Bill J
Charlotte NC