Learning track
Design Patterns
Reusable answers to recurring design problems.
Low-level patterns that shape classes and objects, and high-level patterns that shape whole systems, each shown as running code you can step through.
Part 1
Low-Level Design
Patterns in code: how classes and objects are created, composed and made to work together.
OOP & Design Principles
The ground rules of good code
Objects, interfaces and the principles that keep code easy to change: the vocabulary every pattern in this track is written in.
The Four Pillars of OOP
Encapsulation, abstraction, inheritance and polymorphism, and what each one buys you in real code.
Composition vs Inheritance
Why "has-a" usually beats "is-a": fragile base classes, and building behavior from small parts.
Interfaces & Abstract Classes
Program to an interface, not an implementation: contracts, abstract base classes and when to use each.
Reading UML Class & Sequence Diagrams
The arrows and boxes every design discussion uses: associations, inheritance, composition and message flows.
SOLID Principles
Single responsibility, open/closed, Liskov substitution, interface segregation and dependency inversion.
DRY, KISS, YAGNI & the Law of Demeter
Coupling and cohesion, and the everyday rules of thumb that keep a codebase small and changeable.
Creational Patterns
Control how objects are born
Patterns that decide which class gets created, when, and by whom, so the code that uses an object doesn't have to know how it's built.
Singleton
Exactly one instance with a global access point, and why it is the most misused pattern of all.
Factory Method
Let subclasses decide which concrete class to create, so callers depend only on an interface.
Abstract Factory
Create whole families of related objects (a light theme, a dark theme) without naming their classes.
Builder
Assemble complex objects step by step, and stop writing constructors with ten parameters.
Prototype
Create new objects by cloning a configured example: shallow vs deep copies and registries.
Object Pool
Reuse expensive objects such as connections and threads instead of creating them on every request.
Dependency Injection
Hand objects their collaborators instead of letting them build their own: testability and containers.
Structural Patterns
Compose objects into larger shapes
Patterns for fitting classes together: wrapping, adapting, simplifying and sharing, without rewriting what already works.
Adapter
Make an incompatible interface fit the one your code expects, like a travel plug adapter.
Bridge
Split an abstraction from its implementation so both can vary without a class explosion.
Composite
Treat single objects and groups of objects the same way: trees of shapes, folders and menus.
Decorator
Add behavior to an object at runtime by wrapping it, stacking features without subclassing.
Facade
One simple entry point in front of a complicated subsystem.
Flyweight
Share the common state of thousands of similar objects to save memory.
Proxy
A stand-in that controls access to an object: lazy loading, caching, access checks and remote calls.
Behavioral Patterns
Who does what, and who tells whom
Patterns about responsibilities and communication between objects: swapping algorithms, reacting to events, and modelling state.
Strategy
Swap an algorithm at runtime behind one interface instead of a growing if/else chain.
Observer
Let many objects react when one changes, without the subject knowing who they are.
Command
Turn a request into an object you can queue, log, undo and redo.
State
Let an object change its behavior when its internal state changes, as a clean state machine.
Template Method
Fix the skeleton of an algorithm in a base class and let subclasses fill in the steps.
Chain of Responsibility
Pass a request along a chain of handlers until one deals with it: middleware and approval flows.
Iterator
Walk a collection without exposing how it's stored, and why every language builds it in.
Mediator
Route communication through one hub so objects stop talking to each other directly.
Memento
Capture and restore an object's state without breaking encapsulation: snapshots and undo.
Visitor
Add new operations to a class hierarchy without changing the classes: double dispatch explained.
Interpreter
Represent a small language's grammar as classes and evaluate sentences in it.
Null Object
Replace null checks with an object that does nothing, safely.
Specification
Express business rules as small combinable objects: and, or, not.
Concurrency Patterns
Many threads, one correct answer
Patterns for code that runs on several threads at once: sharing work, sharing data, and waiting for results without races.
Producer-Consumer
Decouple threads that make work from threads that do it with a bounded blocking queue.
Thread Pool
Run many tasks on a fixed set of reusable worker threads, and size the pool sensibly.
Read-Write Lock
Let many readers in at once but give writers exclusive access, and the starvation trade-off.
Future & Promise
Represent a result that isn't ready yet: chaining, combining and handling failures.
Active Object
Give an object its own thread and a request queue, so callers never block on it.
Double-Checked Locking
Lazy initialization without locking on every call, and the memory-model trap that breaks it.
Anti-patterns & Refactoring
Recognize the smell, fix the design
The designs that look fine until they hurt, and how to refactor your way toward the patterns in this track.
God Object, Spaghetti Code & Friends
God objects, primitive obsession, shotgun surgery and other smells, and the patterns that cure them.
Refactoring Toward Patterns
Step-by-step refactors from tangled code to Strategy, State and Factory, with tests keeping you safe.
LLD Case Studies
Design the classes end to end
Interview-style low-level designs: requirements, entities, class diagram, the patterns that fit and why, then working code.
Design a Parking Lot
Spots, vehicles, tickets and payments: the classic LLD question with Strategy and Factory at its core.
Design an Elevator System
Requests, schedulers and car state machines: State and Strategy working together.
Design a Vending Machine
Coins, products and dispensing modelled as a State machine.
Design a Library Management System
Books, copies, members, loans and fines, with Observer for reservations.
Design Splitwise
Expenses, split strategies and simplified debts between friends.
Design BookMyShow (Class Design)
Shows, seats, holds and bookings at class level, with concurrency-safe seat locking.
Design Snake & Ladder and Chess
Boards, pieces, moves and turns: modelling rules cleanly so new games are easy to add.
Design a Rate Limiter (Class Design)
Pluggable token-bucket and sliding-window limiters behind one interface, thread-safe.
Design an LRU Cache (Class Design)
A generic, thread-safe cache with pluggable eviction policies.
Design a Logging Framework
Loggers, levels, formatters and appenders: Chain of Responsibility and Singleton in practice.
Design a Notification Service (Class Design)
Channels, templates and user preferences with Observer, Strategy and Factory.
Design an ATM
Cards, accounts, cash dispensing and transactions modelled as a State machine with Chain of Responsibility.
Part 2
High-Level Design
Patterns for whole systems. Most are taught in full in the System Design track, so they appear here as short pattern cards that link to that lesson.
Architectural Styles
The overall shape of a system
How a whole system is organized: layers, services, events and functions, and what each shape costs you.
Layered, Hexagonal & Clean Architecture
Keep business logic independent of frameworks and databases with layers, ports and adapters.
Monolith, Modular Monolith & Microservices
Three shapes for one system, and the costs that come with splitting it.
Strangler Fig
Replace a legacy system route by route behind a facade instead of in one risky rewrite.
Event-Driven Architecture
Services announce what happened and others react, instead of calling each other directly.
Serverless & Functions as a Service
Run code per event without managing servers: cold starts, limits and when it fits.
Communication & Integration
How services talk
Gateways, messaging, discovery and sidecars: the patterns that connect services to each other and to clients.
API Gateway & Backend for Frontend
One entry point that handles auth, rate limits and routing, and per-client backends that aggregate.
Publish/Subscribe
Publishers send to a topic and any number of subscribers receive, without knowing each other.
Request-Response vs Async Messaging
When to call and wait, and when to send a message and move on.
Service Discovery
Find healthy instances whose addresses keep changing, with a registry and health checks.
Sidecar, Ambassador & Service Mesh
Move networking concerns (retries, TLS, metrics) out of every service and into a proxy beside it.
Competing Consumers
Many workers pull from one queue so work spreads out and scales with the backlog.
Data Management Patterns
Who owns the data, and how it stays right
Patterns for splitting, copying, caching and changing data across services without losing it or corrupting it.
Database per Service
Each service owns its data and others go through its API, never its tables.
CQRS
Separate the model you write to from the models you read from.
Event Sourcing
Store every change as an event and rebuild state by replaying them.
Saga
A long transaction as a series of local steps, each with a compensating undo.
Two-Phase Commit
A coordinator asks every participant to prepare, then to commit, so all or none succeed.
Transactional Outbox
Write the change and the event in one local transaction, and publish the event afterwards.
Sharding
Split data across machines by a key so each holds only part of it.
Replication
Keep copies of data on several machines for reads and failover.
Consistent Hashing
Place keys and servers on a ring so adding a server moves only a small share of the keys.
Cache-Aside, Read-Through & Write-Behind
Where the cache sits relative to the database, and who keeps it up to date.
Materialized View & Denormalization
Precompute the shape a query needs, and pay for it on every write.
Reliability & Resilience
Fail well
Patterns that keep a system up when parts of it are slow, broken or duplicated: stop, retry, isolate and agree.
Circuit Breaker
Stop calling a failing dependency for a while, then test it before trusting it again.
Retry with Backoff & Jitter
Retry transient failures with growing, randomised waits so clients don't stampede.
Idempotent Receiver
Make handling the same message twice harmless with idempotency keys and dedup tables.
Timeout, Bulkhead & Fallback
Bound every wait, isolate resources per dependency, and degrade gracefully when one fails.
Health Check & Heartbeat
Detect dead or sick instances by probing them or listening for regular signs of life.
Leader Election
Make a cluster agree on one coordinator, and replace it safely when it dies.
Quorum
Require enough replicas to agree on reads and writes that every read overlaps the latest write.
Scalability & Performance
Handle more load without falling over
Patterns for spreading load, limiting it, moving work closer to users, and pushing back when there's too much.
Load Balancing
Spread requests across servers with the right algorithm and health checks.
Rate Limiting & Throttling
Cap how fast any one client can call you, with token buckets and sliding windows.
CDN & Edge Caching
Serve content from caches close to users instead of from your origin.
Fan-out on Write vs Fan-out on Read
Do the work when data is written, or when it's read, and the hybrid for celebrities.
Backpressure & Load Shedding
Slow producers down or drop work on purpose before overload takes the whole system down.
Queue-Based Load Leveling
Put a queue between a bursty producer and a steady consumer so spikes don't overwhelm it.
Deployment & Operations
Ship safely, run reliably
Patterns for running software in production: keeping it at the desired state, releasing safely, scaling and seeing inside it.
Desired-State Reconciliation
Declare what should run and let a control loop keep fixing the difference.
Rolling, Blue-Green & Canary Releases
Replace a running version without downtime, and limit the damage of a bad release.
Autoscaling
Add and remove capacity automatically from load signals.
Observability: Tracing & Metrics
Follow one request across services and measure the whole system.
Multi-Tenancy
Serve many customers from one system: isolation models, noisy neighbours and per-tenant limits.