Design Patterns

From principles to the 23 GoF patterns and how to tell similar patterns apart.

Read the first two steps in order. After that, you can read the pattern articles in any order — each lists its own prerequisites.

  1. What are design patterns?

    Sets expectations: patterns are named trade-offs, not recipes to apply everywhere.

  2. SOLID principles

    Most patterns apply the Open/Closed and Dependency Inversion principles; learn the principles and the patterns become easier.

  3. OO design principles: composition over inheritance and more

    The second principle of the GoF book, and the reason most patterns are object-scoped.

  4. The 23 GoF patterns: overview and classification

    A map of the catalogue before diving into individual patterns.

  5. Strategy

    The simplest pattern that demonstrates OCP, DIP and composition together.

  6. Factory Method

    Introduces creational patterns — and the important distinction from simple factories.

  7. Builder

    Immutable objects with many optional fields, and the GoF director form.

  8. Adapter

    The first structural pattern, and the basis of ports and adapters in architecture.

  9. The other creational patterns

    Singleton’s pitfalls, families of products, and creating by copying.

    Also: Abstract Factory, Prototype

  10. The other structural patterns

    Wrapping, simplifying, composing and sharing objects.

    Also: Proxy, Facade, Composite, Bridge, Flyweight

  11. Behavioral patterns: Observer, Command, State and Template Method

    The behavioral patterns you will meet most often in frameworks and domain code.

    Also: Command, State, Template Method

  12. The remaining behavioral patterns

    Chains, traversal, coordination, snapshots, little languages and double dispatch.

    Also: Iterator, Mediator, Memento, Interpreter, Visitor

  13. Compound patterns and MVC

    How patterns combine in real frameworks.

  14. Refactoring toward patterns Planned

    Worked examples of introducing a pattern when the code calls for it, not before.