Skip to content

Design Patterns

The 23 patterns catalogued in Design Patterns: Elements of Reusable Object-Oriented Software by Gamma, Helm, Johnson and Vlissides, the "Gang of Four", grouped by what they are for.

Creational

How objects get made, so that creation logic does not leak into the code that uses them.

Structural

How objects are composed into larger structures.

Behavioural

How objects communicate and distribute responsibility.

  • Dependency Injection, not a GoF pattern, but the usual answer to the coupling these patterns fight

A word of warning

A pattern is a name for a solution to a recurring problem, not a goal. Applying one to a problem you do not have costs you indirection, classes and reading time, and buys nothing. Reach for a pattern when the pressure it relieves is already hurting.