Skip to content
digital garden
Back to Blog

Design Patterns: The Complete Map Before the Journey

8 min read
design-patternssoftware-architecturetypescriptoop

Design Patterns: The Complete Map Before the Journey

Before you can understand design patterns, you need to name them. This article is your map — a labeled catalog of every Gang of Four pattern, organized by category, with just enough context to recognize each one. No code. No deep dives. Just names, categories, and one-line intents.

This is intentional. Research in cognitive science — particularly Bloom's Taxonomy — shows that learning works best when you start at the "Remember" level: identifying and labeling concepts before trying to understand or apply them. Think of it like learning the names of countries on a map before studying their histories.

Once you can name and sort these patterns, you're ready for the detailed articles on Creational, Structural, and Behavioral patterns.

What Is a Design Pattern?

A design pattern is a reusable solution to a commonly occurring problem in software design. It's not a finished piece of code — it's a template for how to solve a problem that can be adapted to many different situations.

The original 23 patterns were cataloged in 1994 by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides — known as the Gang of Four (GoF) — in their book Design Patterns: Elements of Reusable Object-Oriented Software.

The Three Categories

Patterns are grouped by what they do:

CategoryWhat It AddressesCount
CreationalHow objects are created5
StructuralHow objects are composed7
BehavioralHow objects communicate11

Creational Patterns — "How do I make things?"

These patterns deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.

PatternOne-Line IntentReal-World Analogy
SingletonEnsure a class has only one instanceThere's only one president of a country at a time
Factory MethodLet subclasses decide which class to instantiateA hiring manager posts a "developer needed" job — HR decides whether to hire frontend or backend
Abstract FactoryCreate families of related objects without specifying concrete classesAn IKEA furniture line — you pick "modern" or "classic" and get matching chair, table, and sofa
BuilderConstruct complex objects step by stepOrdering a custom pizza — you add toppings one at a time, then call "bake"
PrototypeCreate new objects by cloning an existing onePhotocopying a document instead of retyping it

Deep dive: Creational Design Patterns — From Concept to TypeScript

Structural Patterns — "How do I compose things?"

These patterns deal with object composition — how classes and objects are combined to form larger structures.

PatternOne-Line IntentReal-World Analogy
AdapterMake incompatible interfaces work togetherA power plug adapter for traveling abroad
BridgeSeparate an abstraction from its implementationA TV remote (abstraction) works with any TV brand (implementation)
CompositeTreat individual objects and compositions uniformlyA file system — files and folders are both "items" you can move, copy, delete
DecoratorAdd responsibilities to objects dynamicallyAdding toppings to a coffee — each topping wraps the original order
FacadeProvide a simplified interface to a complex subsystemA hotel concierge — one person handles restaurants, taxis, and tickets for you
FlyweightShare common state between many objects to save memoryA font renderer — the letter "e" shape is stored once, reused millions of times
ProxyProvide a surrogate or placeholder for another objectA credit card is a proxy for your bank account

Deep dive: Structural Design Patterns — From Concept to TypeScript

Behavioral Patterns — "How do things talk to each other?"

These patterns deal with algorithms and the assignment of responsibilities between objects.

PatternOne-Line IntentReal-World Analogy
Chain of ResponsibilityPass a request along a chain of handlersCustomer support escalation — agent → supervisor → manager
CommandEncapsulate a request as an objectA restaurant order ticket — the waiter writes it, the kitchen executes it, you can cancel it
IteratorAccess elements of a collection sequentially without exposing internalsA TV remote's "next channel" button
MediatorDefine an object that encapsulates how a set of objects interactAn air traffic control tower — planes don't talk to each other, they talk to the tower
MementoCapture and restore an object's internal stateThe "undo" feature in a text editor
ObserverNotify multiple objects when one object changes stateA YouTube subscription — you get notified when a channel uploads
StateAlter an object's behavior when its internal state changesA vending machine — behaves differently when it has no coins, has coins, or is dispensing
StrategyDefine a family of algorithms and make them interchangeableGPS navigation — same destination, but you choose fastest, shortest, or scenic route
Template MethodDefine the skeleton of an algorithm, letting subclasses fill in stepsA recipe template — "prep, cook, plate" is fixed, but each dish has different steps
VisitorAdd new operations to existing classes without modifying themA tax inspector visiting different businesses — same inspector, different audit for each type
InterpreterDefine a grammar and an interpreter for a languageA calculator parsing "2 + 3 * 4" according to math rules

Deep dive: Behavioral Design Patterns — From Concept to TypeScript

How Patterns Relate to Each Other

Patterns don't exist in isolation. Here are some common relationships:

  • Factory Method is often used with Template Method — the factory method is a step in a template.
  • Abstract Factory often uses Factory Methods internally.
  • Composite and Iterator are natural partners — you iterate over a composite structure.
  • Observer and Mediator are alternatives — Observer is decentralized, Mediator is centralized.
  • Strategy and State have identical structures but different intents — Strategy swaps algorithms, State swaps behavior based on internal state.
  • Decorator and Proxy have similar structures but different purposes — Decorator adds behavior, Proxy controls access.
  • Command and Memento often work together for undo/redo systems.

How to Use This Series

This series follows a deliberate learning progression:

  1. Label (this article) — Name and categorize every pattern. Build your mental map.
  2. Understand (category articles) — Learn why each pattern exists, what problem it solves, and see it in code.
  3. Compare (within each article) — See how similar patterns differ and when to choose one over another.

Start by reading through the tables above until you can name most patterns from their one-line descriptions. Then pick the category most relevant to your work and dive into the detailed article.

Quick Reference: All 23 Patterns

For fast lookup, here's every pattern sorted alphabetically:

#PatternCategoryIntent
1Abstract FactoryCreationalCreate families of related objects
2AdapterStructuralMake incompatible interfaces work together
3BridgeStructuralSeparate abstraction from implementation
4BuilderCreationalConstruct complex objects step by step
5Chain of ResponsibilityBehavioralPass requests along a chain of handlers
6CommandBehavioralEncapsulate requests as objects
7CompositeStructuralTreat individuals and groups uniformly
8DecoratorStructuralAdd responsibilities dynamically
9FacadeStructuralSimplify a complex subsystem
10Factory MethodCreationalLet subclasses decide what to create
11FlyweightStructuralShare state to save memory
12InterpreterBehavioralDefine a grammar and interpret it
13IteratorBehavioralSequential access without exposing internals
14MediatorBehavioralCentralize complex communications
15MementoBehavioralCapture and restore state
16ObserverBehavioralNotify dependents of state changes
17PrototypeCreationalClone existing objects
18ProxyStructuralControl access via a surrogate
19SingletonCreationalEnsure one instance
20StateBehavioralChange behavior with internal state
21StrategyBehavioralSwap algorithms at runtime
22Template MethodBehavioralDefine algorithm skeleton, defer steps
23VisitorBehavioralAdd operations without modifying classes

Comments

No comments yet. Be the first to comment!