Gang of Four Design Patterns: Catalog Overview and Foundational Concepts

This is the introductory material from *Design Patterns: Elements of Reusable Object-Oriented Software* (Gamma, Helm, Johnson, Vlissides, 1994), commonly known as the "Gang of Four" (GoF) book. It presents the complete catalog of 23 design patterns organized into three categories—Creational, Structural, and Behavioral—along with the foundational framework for understanding what design patterns are, why they matter, and how to apply them.

Key Concepts

Commands and Syntax

No commands per se, but the book establishes a consistent documentation format for each pattern:

Relationships

The 23 Patterns by Category

Creational Patterns (abstract instantiation):

| Pattern | Intent |

|---------|--------|

| Abstract Factory | Interface for creating families of related objects without specifying concrete classes |

| Builder | Separate construction of a complex object from its representation; same process, different representations |

| Factory Method | Define interface for creating an object; let subclasses decide which class to instantiate |

| Prototype | Create new objects by copying a prototypical instance |

| Singleton | Ensure a class has only one instance with a global access point |

Structural Patterns (composition of classes/objects):

| Pattern | Intent |

|---------|--------|

| Adapter | Convert one interface to another that clients expect |

| Bridge | Decouple abstraction from implementation so both vary independently |

| Composite | Tree structures for part-whole hierarchies; treat individual and composite objects uniformly |

| Decorator | Attach additional responsibilities dynamically; flexible alternative to subclassing |

| Facade | Unified higher-level interface to a subsystem |

| Flyweight | Use sharing for large numbers of fine-grained objects |

| Proxy | Surrogate or placeholder to control access to another object |

Behavioral Patterns (algorithms and responsibility assignment):

| Pattern | Intent |

|---------|--------|

| Chain of Responsibility | Decouple sender from receiver; pass request along a chain until handled |

| Command | Encapsulate a request as an object; support parameterization, queuing, logging, undo |

| Interpreter | Define a grammar representation and an interpreter for sentences in the language |

| Iterator | Access aggregate elements sequentially without exposing underlying representation |

| Mediator | Encapsulate object interaction; promote loose coupling |

| Memento | Capture and externalize object state without violating encapsulation; enable restore |

| Observer | One-to-many dependency; automatic notification and update on state change |

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

| Strategy | Family of interchangeable algorithms; algorithm varies independently from clients |

| Template Method | Skeleton algorithm in an operation; subclasses redefine certain steps |

| Visitor | Define new operation without changing element classes |

Exam-Relevant Points