GoF Design Patterns: Bibliography and Master Index
This section comprises the bibliography and comprehensive index from "Design Patterns: Elements of Reusable Object-Oriented Software" (Gamma, Helm, Johnson, Vlissides). The index serves as a master cross-reference revealing pattern participants, inter-pattern relationships, framework usage examples, and key OO design terminology with precise definitions.
Key Concepts
Pattern Participants: Each pattern defines named roles (e.g., Adapter has Client, Target, Adaptee, Adapter; Observer has Subject, Observer, ConcreteSubject, ConcreteObserver). The index maps every participant to its pattern and page.
Pattern Combinations: Patterns are frequently combined — COMPOSITE with ITERATOR, VISITOR, CHAIN OF RESPONSIBILITY, INTERPRETER, and FLYWEIGHT; COMMAND with MEMENTO; MEDIATOR with OBSERVER; ABSTRACT FACTORY with FACTORY METHOD or PROTOTYPE.
Acquaintance vs. Aggregation: Acquaintance is a weaker relationship (one object knows of another); aggregation implies ownership. Both are defined differently in C++ and Smalltalk.
Inheritance vs. Composition: Inheritance is white-box reuse (exposes internals); composition is black-box reuse. Composition is generally preferred — patterns like BRIDGE, STRATEGY, DECORATOR, and STATE favor it.
Interface vs. Implementation Inheritance: Interface inheritance (subtyping) defines what an object can do; implementation inheritance reuses code. These are distinct concepts.
Abstract Coupling: Depending on abstractions rather than concrete classes. Achieved through ABSTRACT FACTORY, OBSERVER, BRIDGE, and FACADE.
Delegation: Forwarding requests to a delegate object. Used in BRIDGE, MEDIATOR, CHAIN OF RESPONSIBILITY, STATE, STRATEGY, and pluggable adapters.
Class Hierarchy Explosion: When combinatorial variations (e.g., platform × widget) cause excessive subclassing. Solved by BRIDGE, DECORATOR, STRATEGY, and FLYWEIGHT.
Polymorphic Iteration: Creating iterators that work across different aggregate types; implemented via FACTORY METHOD in C++.
Hook Operations: Methods in a base class with default (often empty) behavior, overridden by subclasses. Central to TEMPLATE METHOD, also used in ABSTRACT FACTORY, FACTORY METHOD, and PROXY.
Dynamic Binding: Method resolution at runtime based on the object's actual class, not its declared type.
Mixin Class: A class providing optional functionality to be combined via multiple inheritance (e.g., adding serialization or observable behavior).
Commands and Syntax
No CLI commands — this is a reference index. However, important operations referenced:
clone(): Central to PROTOTYPE; must handle deep vs. shallow copy decisions
doesNotUnderstand: Smalltalk message used to implement CHAIN OF RESPONSIBILITY and PROXY via transparent forwarding
dynamic_cast (C++): Used for safe downcasting in COMPOSITE (child management) and ABSTRACT FACTORY
Lazy Initialization: Technique used in FACTORY METHOD — defer object creation until first needed (p. 112)
Copy-on-Write: Optimization technique used with PROXY — share objects and only copy when modified (p. 210)
Relationships
Pattern Comparison Pairs (frequently contrasted):
ADAPTER vs. BRIDGE: ADAPTER retrofits an interface; BRIDGE separates interface from implementation upfront
ADAPTER vs. DECORATOR: ADAPTER changes interface; DECORATOR adds responsibilities without changing interface
23 GoF Patterns are organized by purpose (Creational, Structural, Behavioral) and scope (Class vs. Object). The catalog summary is on pages 8-9.
Pattern participants are named roles, not classes — e.g., "Subject" and "Observer" are roles that concrete classes fill.
COMPOSITE + CHAIN OF RESPONSIBILITY: Parent references in COMPOSITE naturally define a chain of responsibility.
COMPOSITE + FLYWEIGHT: Shared leaf nodes in a composite can be flyweights (used in Lexi's character representation).
INTERPRETER + COMPOSITE: Abstract syntax trees are composites; INTERPRETER adds evaluation behavior.
VISITOR + COMPOSITE + ITERATOR: VISITOR traverses a composite structure using an iterator; double-dispatch resolves the correct visit method.
Double Dispatch: VISITOR uses it to route operations — the element accepts the visitor, then the visitor calls the type-specific method. Required because most OO languages only support single dispatch.
Encapsulation is broken by: inheritance (exposes parent internals to subclass), VISITOR (requires elements to expose state), MEMENTO (carefully avoids breaking it via narrow/wide interfaces).
Key design principles: Program to an interface not an implementation; favor composition over inheritance; encapsulate what varies.
Software lifecycle phases: Prototyping → Expansion → Consolidation. Patterns are used both to design for change and to refactor toward better structure.
Conditional elimination: STATE eliminates conditionals on object state; STRATEGY eliminates conditionals on algorithm selection.
Reference counting: An implementation technique for PROXY (p. 210), enabling shared access to expensive objects.