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.
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 flowSelect a node, or step through the example below.
Read every step
- The common workflow asks its creation hook for a document.
- The PDF subclass supplies a PDF document. A spreadsheet subclass could supply another product.
- 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready have an account? Use the same sign-in. Checks and notes currently stay on this device.
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 flowSelect a node, or step through the example below.
Read every step
- The game asks for input through its usual controller contract.
- The adapter translates that request into the old controller API.
- 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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 startersAlready 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.
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 flowSelect a node, or step through the example below.
Read every step
- The planner receives the fastest-route strategy and delegates calculation.
- That algorithm returns a route.
- The caller selects the scenic strategy instead; the planner’s delegation code stays the same.
- 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 startersAlready 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 startersAlready have an account? Use the same sign-in. Checks and notes currently stay on this device.