Low-Level Design
Object-oriented design for interviews: principles, all 23 classic design patterns in Java, concurrency, schema design, and 22 machine-coding case studies with runnable, tested Java solutions.
What you will learn
- Turn a vague problem into entities, relationships and clean interfaces
- Apply SOLID and the core design principles with judgment, not dogma
- Recognise when each design pattern fits — and when it is over-engineering
- Write thread-safe, extensible, testable Java under interview time pressure
- Solve the most-asked machine-coding problems end to end
Foundations
How LLD rounds work, and the object-oriented building blocks every design rests on.
- The LLD Interview Framework: How design and machine-coding rounds are run and scored, and a repeatable approach.
- OOP Fundamentals in Java: Encapsulation, abstraction, inheritance, polymorphism — and interfaces, equality and immutability.
- Class Relationships & UML: Association, aggregation, composition, dependency and inheritance — and drawing them.
Design Principles
The principles that patterns are built on. Interviewers probe these directly.
- SOLID Principles: Five principles with violations, fixes and the trade-offs of over-applying them.
- Core Design Principles: Encapsulate what varies, program to interfaces, composition over inheritance, DRY, KISS, YAGNI and more.
Creational Patterns
Controlling how objects are created so that code does not depend on concrete classes.
- Singleton: One instance, thread-safe initialisation, and why it is often an anti-pattern.
- Factory Method & Abstract Factory: Decoupling creation from use: simple factory, factory method and families of products.
- Builder: Constructing complex, valid, immutable objects step by step.
- Prototype: Creating objects by cloning, deep vs shallow copies and prototype registries.
Structural Patterns
Assembling objects into larger structures while keeping them flexible.
- Adapter: Making incompatible interfaces work together — object vs class adapters.
- Decorator: Adding behaviour by wrapping, without subclass explosions.
- Facade: A simple front door to a complex subsystem.
- Proxy: Controlling access: lazy, protection, remote, caching and logging proxies.
- Composite: Treating trees of objects and single objects uniformly.
- Bridge: Splitting two dimensions of variation into independent hierarchies.
- Flyweight: Sharing intrinsic state to support huge numbers of small objects.
Behavioral Patterns
How objects collaborate and divide responsibilities. The most-used group in LLD interviews.
- Strategy: Interchangeable algorithms behind one interface.
- Observer: Publish–subscribe inside a process, and its pitfalls.
- State: Behaviour that changes with internal state — the backbone of many machine-coding problems.
- Command: Requests as objects: queues, undo/redo, macros and audit logs.
- Chain of Responsibility: Passing a request along a chain of handlers.
- Template Method: A fixed algorithm skeleton with overridable steps.
- Iterator: Traversing collections without exposing their internals.
- Mediator: Replacing a web of object-to-object calls with a hub.
- Memento: Snapshots for undo without breaking encapsulation.
- Visitor: Adding operations to a stable class hierarchy via double dispatch.
Concurrency & Code Craft
What separates working code from interview-grade code: thread safety, errors, testability.
- Concurrency for LLD: Race conditions, locks, atomics, concurrent collections and producer–consumer in Java.
- Writing Interview-Grade Code: Modelling, validation, exceptions, immutability, testability and common anti-patterns.
- Code Smells & Refactoring: Recognising smells and removing them with small, safe, named refactorings — with a verified worked example.
- Schema Design for LLD: Mapping classes to tables, invariants as constraints, indexes from queries, and concurrency in SQL.
Case Studies: Core
The most frequently asked machine-coding problems, designed and implemented step by step.
- Machine-Coding Walkthrough: Snake & Ladder: A minute-by-minute 90-minute round: scoping, design, code by minute 40, tests and extensions.
- Design a Parking Lot: Spots, vehicles, tickets, pricing strategies and concurrent allocation.
- Design a Vending Machine: The State pattern end to end: coins, selection, dispensing and refunds.
- Design an Elevator System: Requests, scheduling strategies, and a controller for multiple cars.
- Design Tic-Tac-Toe: Board, players, O(1) win detection and an extensible game loop.
- Design an LRU Cache: HashMap + doubly linked list, generic and thread-safe.
- Design a Logging Framework: Levels, appenders, formatters and async logging.
- Design a Library Management System: Catalog, members, loans, reservations and fines.
- Design an In-Memory File System: Composite tree, path resolution, cycle-safe moves, visitors and locking.
- Design a Key-Value Store with Transactions: Nested transactions, optimistic concurrency, versions, tombstones and TTL.
Case Studies: Advanced
Harder problems that combine several patterns with real concurrency and business rules.
- Design Splitwise: Expenses, split strategies, balances and debt simplification.
- Design a Movie Ticket Booking System: Shows, seat locking with expiry, and payments.
- Design Chess: Pieces, move validation, special moves and game state.
- Design a Rate Limiter (LLD): Pluggable algorithms, per-key buckets and thread safety.
- Design an ATM: State machine, cash dispensing chain and bank integration.
- Design a Pub-Sub Message Broker: Topics, subscribers, offsets, and concurrent delivery.
- Design a Job Scheduler: Time-ordered queue, a dispatcher that sleeps until due, fixed rate vs delay, retries and cancellation.
- Design a Notification Service: Channels, templates, preferences, quiet hours, priority, dedup, failover and dead letters.
Case Studies: Business Systems
Product-company favourites where business rules, money and concurrency meet.
- Design a Cab Booking System: Spatial index, atomic driver claims, ride lifecycle and surge pricing.
- Design a Food Delivery System: Single-restaurant cart, coupons, order state machine, limited stock and partners.
- Design a Hotel Booking System: Half-open date ranges, O(log n) availability, per-room locks and per-night pricing.
- Design a Digital Wallet: Double-entry ledger, idempotent transfers, ordered locking, limits and refunds.
Revision
Consolidate patterns and principles before an interview.
- Choosing & Comparing Patterns: Problem-to-pattern mapping and the comparisons interviewers ask about.
- LLD Cheat Sheet: Principles, patterns, concurrency tools and case-study one-liners on one page.