Gang of Four Design Patterns: Catalog Overview and Pattern Fundamentals
This is the foundational reference from *Design Patterns: Elements of Reusable Object-Oriented Software* (Gamma, Helm, Johnson, Vlissides, 1994). It catalogs 23 design patterns organized into three categories — Creational, Structural, and Behavioral — and defines what a design pattern is, its four essential elements, and how patterns capture reusable solutions to recurring object-oriented design problems.
Key Concepts
Design pattern: A named, reusable solution to a recurring problem in a context — not a concrete design but a template applicable in many situations.
Four essential elements of a pattern: (1) Pattern name, (2) Problem (when to apply), (3) Solution (elements, relationships, responsibilities), (4) Consequences (trade-offs, costs, benefits).
Three pattern categories: Creational (object creation), Structural (composition of classes/objects), Behavioral (communication and responsibility assignment between objects).
Patterns are not novel inventions — they capture proven, recurring solutions from experienced designers that have been applied multiple times in different systems.
Christopher Alexander's influence: The pattern concept originates from architecture — "each pattern describes a problem which occurs over and over again... and then describes the core of the solution."
Pattern names raise the level of abstraction — they create a shared vocabulary for discussing design decisions with colleagues.
Consequences include: flexibility, extensibility, portability, space/time trade-offs, and language/implementation concerns.
The book's scope is deliberately limited: no concurrency, distributed, real-time, or domain-specific patterns.
Commands and Syntax
No commands per se, but the catalog uses a consistent documentation format for each pattern:
Pattern Name and Classification
Intent — what the pattern does (one-sentence summary)
Also Known As — alternative names
Motivation — scenario illustrating the problem
Applicability — when to use
Structure — class/object diagrams
Participants — classes/objects and responsibilities
Collaborations — how participants work together
Consequences — trade-offs
Implementation — pitfalls, techniques, language issues
Sample Code — code illustration
Known Uses — real-world examples
Related Patterns — connections to other patterns
Relationships
Creational Patterns (object instantiation):
| Pattern | Intent |
|---------|--------|
| Abstract Factory | Interface for creating families of related objects without concrete classes |
| Builder | Separate construction from representation; same process, different results |
| Factory Method | Defer instantiation to subclasses via an interface |
| Prototype | Create objects by cloning a prototypical instance |
| Singleton | Ensure one instance with a global access point |
Structural Patterns (composition):
| Pattern | Intent |
|---------|--------|
| Adapter | Convert incompatible interfaces |
| Bridge | Decouple abstraction from implementation for independent variation |
| Composite | Tree structures for part-whole hierarchies; uniform treatment |
| Decorator | Dynamic responsibility attachment; flexible alternative to subclassing |
| Facade | Unified higher-level interface to a subsystem |
| Flyweight | Sharing to efficiently support fine-grained objects |
| Proxy | Surrogate/placeholder to control access |
Behavioral Patterns (interaction):
| Pattern | Intent |
|---------|--------|
| Chain of Responsibility | Decouple sender/receiver; pass request along a chain |