This is a book about programming in an object -oriented way and about how to use design patterns to solve commonplace problems in object-oriented systems.
I've based this book on the philosophy that the best way to learn and understand the design patterns is to see them in action, all jumbled up, just as they occur in the real world.
Consequently, this book presents design patterns to you by looking at computer programs. My intent is to both clarify and bring down to earth Gamma, Helm, Johnson, and Vlissides's seminal work Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley, 1995). (The four authors are often called the Gang of Four [or GoF], and their book is usually called the Gang-of-Four book.) The current volume puts the GoF book into context, presenting and teaching design patterns as they occur in the real world. By the time you're done, you'll have seen all of the Gang-of- Four patterns but in the context of real computer programs.
Don't get me wrong-this book does not pretend to supplant the GoF book but rather to complement it. Gamma, Helm, Johnson, and Vlissides made an enormous contribution to the 00-design community with their work, and this book certainly wouldn't exist without it. The GoF approach is abstruse and dense to many programmers, however, thus the need for the current volume.
The current book is atypical-it's "inside out" when compared to other books on design patterns. Rather than catalog the design patterns and present unrealistically simple examples in each section of the catalog, this book describes two computer programs in terms of the design patterns they use. You see how the patterns appear in real programs and how the patterns interact with one another in complex ways.
The splendid isolation of a catalog-of-design-patterns approach (such as the original Design Patterns) simply doesn't permit this real-world understanding. The catalog is great if you've already worked on code that demonstrates the pattern. If you don't have prior experience with such code, however, the catalog approach is impenetrable. Also, catalogs can leave you with a good intellectual understanding of the patterns but with almost no understanding of how to actually use the patterns to produce real code.