Design Patterns Cheat Sheet (All 16, One Page)
All 16 must-know design patterns on one page, grouped into Creational, Structural and Behavioural families — each with a one-line what-it-does and when-to-use, linking to the full Java deep-dive.
🟠Resource · Cheat Sheet · Bookmark this
Every design pattern you'll be asked about, on one page — grouped into the three GoF families, each with a one-line "what it does" and "when to reach for it," linking to the full deep-dive with Java code. Perfect for a pre-interview refresh or to jog your memory mid-LLD problem.
🟢 Creational — how objects are made
- Singleton — one shared instance. When: config, logger, connection pool.
- Factory Method — a method decides which subclass to create. When: caller shouldn't know concrete types.
- Abstract Factory — a factory of related factories. When: whole families of objects (e.g. cross-platform UI).
- Builder — step-by-step construction. When: many optional params / immutable objects.
- Prototype — clone an existing object. When: creation is expensive.
🔵 Structural — how objects are composed
- Adapter — makes an incompatible interface fit. When: integrating a third-party/legacy API.
- Decorator — add behaviour by wrapping. When: optional features without subclass explosion.
- Facade — one simple front for a complex subsystem. When: hide internal complexity.
- Proxy — a stand-in that controls access. When: lazy load, caching, access control.
- Composite — treat a tree of objects like one object. When: part-whole hierarchies (files/folders).
🟠Behavioural — how objects talk
- Strategy — interchangeable algorithms. When: multiple ways to do one thing (payment, sort, split).
- Observer — notify subscribers on change. When: events, pub/sub, UI updates.
- State — behaviour changes with internal state. When: lifecycles / state machines (ATM, order).
- Command — wrap a request as an object. When: undo/redo, queues, audit logs.
- Template Method — fixed skeleton, overridable steps. When: same flow, varying details.
- Chain of Responsibility — pass a request along handlers. When: filters, middleware, level handling.
Spotting them in case studies
Patterns click when you see them applied. A few from this series: ATM = State + Command + Chain · Splitwise = Strategy · logging framework = Chain + Strategy + Singleton · food delivery = State + Strategy + Observer. Start from the hub: design patterns in Java.
The golden rule
🔴 Don't force a pattern — reach for one only when it removes real pain (duplicated conditionals, rigid creation, tangled dependencies). Naming the pattern is worth marks; misapplying one costs them. Ground every choice in SOLID.
What to read next
- Design Patterns in Java (hub) — all 16, with full code
- System Design Cheat Sheet — the HLD companion
- 6-Week Study Plan — fit patterns into your prep