Design patterns
Once by the book.
Once in production.
A pattern as the literature describes it, then the shape it takes in a real system. See what changes, why it changes, and when to reach for it — from creating a value to coordinating a set of collaborators.
Moving in. 69 of 73 topics have lessons; they're moving over from the old site.
Moving in 69 of 73 topics have lessons, which are moving over from the old site. Planned topics show where the catalog is going.
Creation and lifecycle
Making things, keeping them valid, and deciding how long they live.
Composition and interfaces
What wraps what, and where one interface meets another.
Behavior and collaboration
Who talks to whom, who makes the decision, and who owns the work.
Application patterns
Reusable arrangements at the seams of an application.
Repository pattern & its critics
Put a boundary around persistence, and decide when the extra abstraction helps
TypeScriptGoSelection, creation, and lifecycle
Compositions about choosing behavior, creating instances, and managing their lifetime.
Factory + Strategy
A factory selects or creates a strategy; the strategy supplies interchangeable behavior.
TypeScriptGoFactory Method + Strategy
An overridable creation hook supplies a strategy object. A standalone lesson needs an ownership or lifecycle decision beyond Factory + Strategy and Factory Method + Template Method.
Factory Method + Template Method
A fixed workflow calls a creation hook that subclasses vary. Teach the pattern gap before the pairing.
TypeScriptGoRegistry + Strategy
A registry discovers named strategies; callers invoke them through one stable contract.
TypeScriptGoRegistry + Factory
A registry resolves a named provider; the provider creates an instance with a separate lifetime.
TypeScriptGoPrototype + Registry
A registry finds a configured prototype to clone and customize, with copy depth made explicit.
TypeScriptGoAbstract Factory + Strategy
An abstract factory supplies a compatible product family while a strategy varies behavior independently.
TypeScriptGoBridge + Abstract Factory
An abstract factory supplies a compatible playback backend and timestamp index; a bridge keeps the listening session independent of the backend.
TypeScriptGoFactory + Object Pool
A factory creates schema-configured instances on pool demand while the pool owns capacity, leases, return, reset, and retirement.
TypeScriptGoMultiton + Lazy Initialization
A shift-scoped owner lazily retains one sample history per buoy; removal starts a new generation while held histories remain usable.
TypeScriptGoLazy Initialization + Proxy
A permission-checking proxy constructs a design-review preview renderer on first allowed use and defines sequential failure retry.
TypeScriptGoAbstract Factory + Builder
An abstract factory selects a compatible product family; a builder assembles one valid result from it.
TypeScriptGoSingleton + Lazy Initialization
One owner creates its shared instance on first demand, with scope and initialization failure made explicit.
Registry + Abstract Factory
A registry selects a named product family; the abstract factory creates compatible products within it.
TypeScriptGoTrees, expressions, and construction
Compositions about building nested structures and adding operations over them.
Composite + Iterator
Composite owns the tree; an iterator controls traversal order and demand.
TypeScriptGoComposite + Visitor
Composite owns stable structure while visitors add operations over its node types.
TypeScriptGoComposite + Interpreter
Composite supplies expression-tree shape; an interpreter evaluates nodes against fresh context.
TypeScriptGoInterpreter + Visitor
An interpreter evaluates a supplied group-booking rule tree; visitors add independent policy-printing and fact-inventory operations over its stable nodes.
TypeScriptGoComposite + Flyweight
A nested quilt keeps every patch occurrence distinct while sharing canonical immutable fabric descriptions.
TypeScriptGoBuilder + Composite
A builder publishes a validated cloud capability catalog; Composite provides ordered leaves and subtree counts.
TypeScriptGoBuilder + Prototype
A builder starts from a configured prototype copy, with retained references and copy depth explicit.
TypeScriptGoComposite + Decorator
Decorators add behavior to individual tree nodes while preserving the component contract and traversal rules.
TypeScriptGoComposite + Proxy
A composite keeps one whole/part query while independent branch proxies retain acquired targets and preserve captured generation identity.
TypeScriptGoIterator + Visitor
An iterator controls traversal order and demand; a visitor performs an operation at each node.
TypeScriptGoCommand + Interpreter
An interpreter prepares inert commands from a saved description; a separate invoker authorizes the whole batch and reports an honest applied prefix.
TypeScriptGoBehavior, dispatch, and history
Compositions about routing work, accepting transitions, and preserving or reporting outcomes.
Decorator + Strategy
A strategy supplies behavior while decorators wrap its contract; order and failure propagation stay visible.
TypeScriptGoChain of responsibility + Command
Commands package requests; a chain decides which handler claims each one.
TypeScriptGoCommand + Memento
Commands represent actions while mementos capture restorable state, apart from external side effects.
TypeScriptGoCommand + Observer
A command commits a weekly-box preference before direct observers receive the immutable result.
TypeScriptGoState machine + Command
A state machine accepts a transition before commands carry out its effects.
TypeScriptGoState machine + Observer
The owner retains accepted transition facts for returning observers while current state and live readers continue.
TypeScriptGoState machine + Memento
A state machine guards restoration of saved phase and prerequisite data while external receipts stay current.
TypeScriptGoMediator + Observer
A mediator commits joint participant decisions before optional observers receive detached outcome facts.
TypeScriptGoNull Object + Strategy
A no-op strategy represents deliberate optional behavior, distinct from a missing or failed strategy.
Template Method + Strategy
Template Method fixes the workflow while a strategy supplies a replaceable policy for one step.
Chain of responsibility + Decorator
An ordered handler chain controls progression and short-circuiting; a Decorator records each outcome without changing it.
TypeScriptGoCommand + Publish / subscribe
Commands commit requested changes before outcome facts enter independent subscriber inboxes for processing and retry.
TypeScriptGoState machine + Strategy
A state owner grants permission, invokes an independently selected calculation policy, and validates its candidate before retaining an accepted record.
TypeScriptGoIntegration and boundaries
Compositions about translating interfaces, coordinating subsystems, and guarding shared results.
Adapter + Facade
Adapters translate individual interfaces; a facade coordinates a simpler subsystem workflow.
TypeScriptGoAdapter + Repository
A repository keeps application persistence policy stable while adapters translate native records, units and conditional write protocols.
TypeScriptGoAdapter + Decorator
Adapters normalize foreign replies; decorators apply independent request and result policies around the stable application contract.
TypeScriptGoAdapter + Proxy
An adapter validates a complete canonical artifact before a proxy retains it under current access and application identity.
TypeScriptGo