Scan with Phone

Scan to instantly open and share this page on your mobile device.

Link copied to clipboard!

Design Patterns (GoF 23)

Simple index. Each pattern: small intent. Style: almost mathematical, simple English.
Notation: Object set O, Class set C, Interface set I, Behavior (method) set B.

Creational (make objects)

  1. Singleton — ensure |instances(P)| = 1.
  2. Factory Method — choose subclass via f(): C_base → C_concrete.
  3. Abstract Factory — group creation: F: Family → (Product_1 × ... × Product_n).
  4. Builder — separate build steps s₁..s_k from final assemble A.
  5. Prototype — clone: new(o) = copy(o) without class knowledge.

Structural (compose objects)

  1. Adapter — adapt target interface: g = wrap(f) so sig(g)=Target.
  2. Bridge — split Abstraction × Implementor to reduce |A×I| coupling.
  3. Composite — tree T where Leaf and Node share I: uniform op.
  4. Decorator — add behavior: x' = D(x) preserving interface.
  5. Facade — map complex subsystem S to simple interface F.
  6. Flyweight — share intrinsic state: extrinsic passed per use.
  7. Proxy — control access: p(x) mediates real r(x).

Behavioral (coordinate behavior)

  1. Chain of Responsibility — handlers h₁→h₂→... stop at first accept.
  2. Command — encapsulate request: cmd := (execute, undo).
  3. Interpreter — grammar G → class tree; eval(node) recursively.
  4. Iterator — expose sequence: next(): O ∪ {Ø}.
  5. Mediator — central M: reduce edges from O(n²) to O(n).
  6. Memento — capture state σ; restore(σ).
  7. Observer — subject S: notify all o ∈ Obs when state Δ.
  8. State — behavior depends on current q ∈ Q; transition on event.
  9. Strategy — swap algorithm: context uses a ∈ A via common I.
  10. Template Method — algorithm skeleton fixed; steps overridden.
  11. Visitor — add ops: double dispatch visit(Structure, Visitor).

Graph View

Force graph: 3 category nodes (C) and pattern nodes (P). Edge (C,P) if P in C.

Palette: Category=#1d4ed8, Pattern=#0d9488.
© 2025 Patterns quick index. Unified color scheme applied.
next