Tutorials /

THE PATTERN ATLAS · 23 WAYS TO THINK

See the structure.
Follow the idea.

Explore the classic design patterns through moving diagrams. Choose a branch, meet the objects, then follow what happens between them.

Try Factory Method, Adapter and Strategy in full—one from each family. A free account opens the remaining patterns. No payment details.

CREATIONAL / DESIGN PATTERNS

Factory Method.

Let a subclass choose which concrete product a creation method returns, while the surrounding workflow uses a common product contract.

BEFORE YOU START

Tools you’ll need

Choose Watch it work, Try a change or Check understanding in this page. The code illustrates the pattern; no editor, terminal or SDK is needed.

Required
  • Web browserYou are already using it. No installation for reading or in-page activities.
Optional
Not sure which app is which? Explore the Tools Wiki ↗

An export workflow produces either a PDF or a spreadsheet.

Arrows show the labelled relationships. The highlighted connection shows the current step. Select a node to explore its role.

Follow the flow

Select a node, or step through the example below.

Read every step
  1. The common workflow asks its creation hook for a document.
  2. The PDF subclass supplies a PDF document. A spreadsheet subclass could supply another product.
  3. The workflow continues through the document contract; it does not need PDF construction details.

What is it?

Let a subclass choose which concrete product a creation method returns, while the surrounding workflow uses a common product contract.

Where it helps

Use when a framework workflow should stay stable while subclasses supply product variants.

The trade-off

A helper with a switch is a simple factory, not automatically the Factory Method pattern. Avoid a subclass hierarchy for a single fixed product.

YOUR NEXT CHAPTER · STILL FREE

Abstract Factory

Create a family of related products through one factory contract.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Builder

Assemble a complex object in explicit steps, separating construction from the final representation.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Prototype

Create a new object by copying an existing configured object.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Singleton

Restrict a class to one instance within a defined scope and provide an access point to it.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

STRUCTURAL / DESIGN PATTERNS

Adapter.

Translate an existing API into the interface a client expects.

BEFORE YOU START

Tools you’ll need

Choose Watch it work, Try a change or Check understanding in this page. The code illustrates the pattern; no editor, terminal or SDK is needed.

Required
  • Web browserYou are already using it. No installation for reading or in-page activities.
Optional
Not sure which app is which? Explore the Tools Wiki ↗

A game expects a standard controller API, but an older controller reports different inputs.

Arrows show the labelled relationships. The highlighted connection shows the current step. Select a node to explore its role.

Follow the flow

Select a node, or step through the example below.

Read every step
  1. The game asks for input through its usual controller contract.
  2. The adapter translates that request into the old controller API.
  3. The translated result returns to the game. The game does not need legacy-specific calls.

What is it?

Translate an existing API into the interface a client expects.

Where it helps

Use at integration boundaries with incompatible interfaces.

The trade-off

Translation must preserve meaning, including units and errors. An adapter cannot invent a capability the old device lacks.

YOUR NEXT CHAPTER · STILL FREE

Bridge

Separate an abstraction from its implementation so both can vary independently.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Composite

Treat individual items and groups through a shared interface, allowing recursive structures.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Decorator

Wrap an object to add behaviour while preserving the interface clients use.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Facade

Offer a small, convenient entry point to a more complex subsystem.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Flyweight

Share reusable intrinsic state between many objects, while supplying per-use state separately.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Proxy

Place a stand-in behind the same interface to control access to another object.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Chain of Responsibility

Pass a request through potential handlers until one handles it or the chain ends.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Command

Represent an action as an object so it can be passed around, queued or recorded.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Interpreter

Represent a small language as expression objects that can evaluate themselves within a context.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Iterator

Traverse a collection through a standard protocol without exposing its internal storage.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Mediator

Route interactions between related objects through a coordinator instead of connecting every object directly to every other.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Memento

Capture an object’s state so it can later be restored without exposing that state’s internals to the keeper.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Observer

Let subscribers receive notifications when a subject changes.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

State

Delegate state-dependent behaviour to state objects, changing the active state as the object transitions.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

BEHAVIOURAL / DESIGN PATTERNS

Strategy.

Encapsulate interchangeable algorithms behind a common contract and let a context use the selected one.

BEFORE YOU START

Tools you’ll need

Choose Watch it work, Try a change or Check understanding in this page. The code illustrates the pattern; no editor, terminal or SDK is needed.

Required
  • Web browserYou are already using it. No installation for reading or in-page activities.
Optional
Not sure which app is which? Explore the Tools Wiki ↗

A route planner switches between fastest and scenic routing.

Arrows show the labelled relationships. The highlighted connection shows the current step. Select a node to explore its role.

Follow the flow

Select a node, or step through the example below.

Read every step
  1. The planner receives the fastest-route strategy and delegates calculation.
  2. That algorithm returns a route.
  3. The caller selects the scenic strategy instead; the planner’s delegation code stays the same.
  4. The new algorithm returns its alternative route through the same contract.

What is it?

Encapsulate interchangeable algorithms behind a common contract and let a context use the selected one.

Where it helps

Use when clients need a choice of algorithms without a growing conditional in the context.

The trade-off

The caller still needs a way to choose the strategy. State changes behaviour with lifecycle; Strategy usually represents a selected approach.

YOUR NEXT CHAPTER · STILL FREE

Template Method

Define an algorithm’s fixed sequence in a base class while allowing subclasses to customise selected steps.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

YOUR NEXT CHAPTER · STILL FREE

Visitor

Add operations to a stable object structure by passing a visitor whose methods handle each concrete element type.

Ready for the next step? A free ClassAntics account opens the rest of the lessons, stories and interactive examples whenever you’re ready.

No payment details. No subscription. Your next lesson will be waiting after sign-in.

Continue free →Explore the free starters

Already have an account? Use the same sign-in. Checks and notes currently stay on this device.

These are the 23 classic patterns catalogued by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides in Design Patterns (1994). They are a vocabulary for recurring design problems, not a checklist for every project.

Explore the original book (new tab) ↗

The diagrams illustrate selected collaborations, rather than complete UML or executable programs. A simpler design is often the right starting point.