Builder
Construct a complex object step-by-step, allowing the same construction process to produce different representations.
Read →Catalog
Time-tested solutions to recurring design problems — explained in plain language with PHP, TypeScript, and Python examples.
Design patterns are the names we give to solutions that keep showing up. You don't memorize them to look smart — you learn them so the next time a problem walks in, you recognize the shape and reach for the move that fits. The catalog below mirrors the classic GoF taxonomy: creational, structural, and behavioral. Each entry takes ~5 minutes to read, opens with a real-world scenario, and ends with the patterns it relates to so you can keep pulling the thread.
Patterns about how objects get made — and how to keep that decision flexible.
Construct a complex object step-by-step, allowing the same construction process to produce different representations.
Read →Define an interface for creating an object, but let subclasses decide which class to instantiate.
Read →Ensure a class has only one instance, and provide a single global point of access to it.
Read →Provide an interface for creating *families* of related objects without specifying their concrete classes — so the whole family stays consistent.
Read →Create new objects by copying an existing, well-configured prototype rather than constructing from scratch.
Read →Patterns about how objects compose and relate — building bigger things from smaller ones without rigid coupling.
Convert the interface of an existing class into one your client code expects — so the two can work together without either side changing.
Read →Compose objects into tree structures so that clients can treat individual objects and groups of objects uniformly.
Read →Provide a single, simple interface to a complex subsystem — so callers don't have to know about every moving part.
Read →Attach additional behavior to an object dynamically by wrapping it in another object that shares the same interface.
Read →Provide a stand-in for another object that controls access to it — for lazy loading, authorization, caching, logging, or remote calls.
Read →Decouple an abstraction from its implementation so that the two can vary — and grow — independently.
Read →Share common state across many fine-grained objects so the system can scale to numbers a naive design couldn't fit in memory.
Read →Patterns about how objects communicate and divide responsibility — moving control without spaghetti.
Turn a request into a stand-alone object so it can be queued, logged, retried, scheduled, or undone.
Read →Walk through the elements of a collection without exposing how the collection is laid out underneath.
Read →Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified automatically.
Read →Define a family of algorithms, encapsulate each one, and make them interchangeable so the code that uses them never has to change.
Read →Pass a request along a chain of handlers — each handler either deals with it or forwards it to the next.
Read →Centralize complex communications between related objects through a single coordinator — so the objects don't need to know about each other directly.
Read →Capture an object's internal state so you can restore it later — without exposing the object's internals to the rest of the system.
Read →Allow an object to alter its behavior when its internal state changes — so it appears to change its class.
Read →Define the skeleton of an algorithm in a base class, and let subclasses fill in specific steps without changing the algorithm's structure.
Read →Define a representation for a small language's grammar and an interpreter that evaluates sentences in that language.
Read →Add new operations across a stable hierarchy of objects without modifying the classes themselves.
Read →