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

Commands and Syntax

No commands per se, but the catalog uses a consistent documentation format for each pattern:

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 |

| Command | Encapsulate request as object; enables queue, log, undo |

| Interpreter | Grammar representation + interpreter for a language |

| Iterator | Sequential access without exposing representation |

| Mediator | Encapsulate object interaction; promote loose coupling |

| Memento | Externalize state for later restoration without breaking encapsulation |

| Observer | One-to-many dependency with automatic notification |

| State | Alter behavior when internal state changes; appear to change class |

| Strategy | Encapsulate interchangeable algorithms; vary independently from clients |

| Template Method | Algorithm skeleton with subclass-deferred steps |

| Visitor | New operations without changing element classes |

Recommended starting patterns for less experienced designers: Abstract Factory, Factory Method, Adapter, Composite, Decorator, Observer, Strategy, Template Method.

Exam-Relevant Points