Command Palette

Search for a command to run...

Roadmap
Phase 2Beginner4 of 19 in the curriculum

Design Patterns

The 22 GoF patterns that show up in LLD interviews — each tied to the problem it solves, with Java.

Design patterns are solutions to recurring design problems — they exist because a production problem burned someone first. Learn the intent and the trade-off, not the diagram.

Interview rule: you must be able to say which concrete LLD problem each pattern solves (e.g. State → vending machine, Strategy → pricing), and you must read the GoF names fluently.

0/22 · 0%
22 topics ~2 h 22 code blocks & diagrams
Start with the first topic

Creational

Structural

Behavioral

13

Behavioral 1 — Strategy

Behavioral

Encapsulate a family of algorithms behind one interface and swap them at runtime — the single most used pattern in LLD interviews.

8 min 1 code practice

14

Behavioral 2 — Observer

Behavioral

One subject notifies many listeners when its state changes — the publish/subscribe idea in-process.

7 min 1 code practice

15

Behavioral 3 — Command

Behavioral

Wrap a request (and its receiver) into an object — enables undo/redo, queuing, logging, and macros.

7 min 1 code practice

16

Behavioral 4 — State

Behavioral

An object changes behavior when its state changes — state logic moves from if/else soup into per-state classes. The vending machine pattern.

8 min 1 code practice

17

Behavioral 5 — Template Method

Behavioral

Define the skeleton of an algorithm in a base class, let subclasses fill in specific steps — inversion of control inside one class hierarchy.

6 min 1 code practice

18

Behavioral 6 — Chain of Responsibility

Behavioral

Pass a request along a chain of handlers; each handler decides to process it or pass it on. Middleware, filters, validators.

6 min 1 code practice

19

Behavioral 7 — Iterator

Behavioral

Provide sequential access over a collection without exposing its internals. Mostly baked into Java today — nested iterators (tree walks, pagination) still show up.

6 min 1 code practice

20

Behavioral 8 — Mediator

Behavioral

Centralize interactions between many objects so they talk to one mediator instead of each other — star topology.

7 min 1 code practice

21

Behavioral 9 — Memento

Behavioral

Save a snapshot of an object's state so you can restore it later, without exposing its private fields. Think 'save game' in a video game.

7 min 1 code practice

22

Behavioral 10 — Visitor

Behavioral

Add new operations to a group of classes without changing those classes. The operation 'visits' each object and does the right thing for its type.

7 min 1 code practice