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.
Sets expectations: patterns are named trade-offs, not recipes to apply everywhere.
Most patterns apply the Open/Closed and Dependency Inversion principles; learn the principles and the patterns become easier.
OO design principles: composition over inheritance and more
The second principle of the GoF book, and the reason most patterns are object-scoped.
The 23 GoF patterns: overview and classification
A map of the catalogue before diving into individual patterns.
The simplest pattern that demonstrates OCP, DIP and composition together.
Introduces creational patterns — and the important distinction from simple factories.
Immutable objects with many optional fields, and the GoF director form.
The first structural pattern, and the basis of ports and adapters in architecture.
Singleton’s pitfalls, families of products, and creating by copying.
Also: Abstract Factory, Prototype
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
The remaining behavioral patterns
Chains, traversal, coordination, snapshots, little languages and double dispatch.
Also: Iterator, Mediator, Memento, Interpreter, Visitor
Many patterns share a structure; comparing them teaches intent.
Also: Factory Patterns Compared, Strategy vs State vs Template Method, Observer vs Mediator vs Event Bus
How patterns combine in real frameworks.
Refactoring toward patterns Planned
Worked examples of introducing a pattern when the code calls for it, not before.