# Low Level Design
All Low Level Design notes →1 — What is Low-Level Design?
How Low-Level Design differs from High-Level Design, where it sits in the software development lifecycle, and the criteria MAANG interviewers actually use to evaluate it.
2 — Object-Oriented Programming Refresher
A fast recap of the four OOP pillars — encapsulation, abstraction, inheritance, and polymorphism — plus the composition-over-inheritance tradeoff the rest of this book leans on.
3 — Relationships Between Objects
The association, aggregation, composition, and dependency relationships objects can hold with each other, grounded in real-world examples.
4 — Object Lifecycle
How an object comes into existence and who owns it — creation, memory allocation, constructors, factory-based creation, and ownership semantics.
1 — SOLID Principles
The five SOLID principles — Single Responsibility through Dependency Inversion — as the baseline design discipline every LLD interview answer gets measured against.
2 — GRASP Principles
The nine GRASP patterns — Information Expert, Creator, Controller, Low Coupling, High Cohesion, and more — for assigning responsibility to the right class.
3 — OO Design Heuristics
Practical heuristics beyond SOLID and GRASP — favoring composition, programming to interfaces, the Law of Demeter, Tell Don't Ask, and Command Query Separation.
4 — Clean Code
The clean-code habits — naming, small methods, spotting code smells, and refactoring for readability — that keep a well-principled design from decaying in practice.
1 — UML Fundamentals
The UML notation vocabulary — classes, interfaces, relationships, visibility, and multiplicity — needed to read or draw any diagram in this Part.
2 — Class Diagrams
How class diagrams capture a design's static structure — classes, attributes, methods, and the relationships between them — before any code gets written.
3 — Sequence Diagrams
How sequence diagrams trace the message flow between objects over time to check that a design actually satisfies a use case.
4 — State Diagrams
How state diagrams model an object's lifecycle as a finite set of states and transitions, useful for anything with a status field.
5 — Activity Diagrams
How activity diagrams map the control flow and branching logic of a workflow or business process, independent of any single class.
6 — Object Diagrams
How object diagrams snapshot a specific set of instances and their links at a point in time, useful for validating a class diagram against a concrete scenario.
7 — Package Diagrams
How package diagrams organize classes into higher-level modules and show the dependencies between them, the tool for reasoning about a design's overall structure.
1 — Introduction to Design Patterns
What a design pattern actually is, why the Gang-of-Four catalog still matters in interviews, and how to recognize which category a problem is asking for.
2 — Creational Patterns
The five creational patterns — Singleton, Factory Method, Abstract Factory, Builder, and Prototype — for controlling how and when objects get created.
3 — Structural Patterns
The seven structural patterns — Adapter, Bridge, Composite, Decorator, Facade, Flyweight, and Proxy — for composing classes and objects into larger structures.
4 — Behavioral Patterns
The eleven behavioral patterns — from Strategy and Observer through Visitor and Interpreter — for managing communication and responsibility between objects.
5 — Pattern Selection Guide
A decision framework for picking the right pattern under interview pressure — when to reach for one, when it's overkill, and the trade-offs behind each choice.
1 — Dependency Injection
Compares constructor, setter, and interface injection as ways to supply an object's dependencies from outside itself rather than constructing them internally.
2 — Inversion of Control
Explains how inverting control of object creation and lifecycle from application code to a framework or container reshapes dependency flow in a design.
3 — Service Locator vs DI
Contrasts the service locator pattern with dependency injection, weighing hidden dependency lookups against explicit, visible constructor contracts.
4 — Object Factories
Covers factory patterns that encapsulate object construction logic and decouple it from the code that consumes the resulting objects.
1 — Exception Design
Looks at how to design exception hierarchies and error-signaling contracts so that failures are informative and recoverable rather than opaque.
2 — Validation Strategies
Surveys strategies for validating input and state at system boundaries versus deep within business logic, and where each belongs.
3 — Defensive Programming
Examines defensive programming techniques for guarding against invalid state and unexpected input without over-defending against impossible cases.
4 — Immutability
Explains how immutable objects eliminate mutation after construction, closing off a whole class of concurrency and state-corruption bugs.
5 — Value Objects
Introduces value objects as small, immutable types defined by their attributes rather than identity, and where they should replace bare primitives.
1 — Thread Safety
Defines what it means for a class or method to be thread-safe and the correctness guarantees a design must uphold under concurrent access.
2 — Synchronization
Covers synchronization mechanisms that coordinate access to shared mutable state across multiple threads.
3 — Locks
Examines lock types — mutexes, read-write locks, reentrant locks — and the tradeoffs each makes between safety and throughput.
4 — Concurrent Collections
Surveys concurrent collection types designed for safe multi-threaded access without requiring external locking by the caller.
5 — Producer Consumer
Walks through the producer-consumer pattern for decoupling work generation from work processing via a shared bounded queue.
6 — Thread Pools
Explains thread pool design for bounding concurrency and reusing worker threads instead of spawning a new thread per task.
7 — Deadlocks
Analyzes how deadlocks arise from circular resource dependencies among threads and the design practices that prevent them.
8 — Race Conditions
Examines how race conditions emerge from unsynchronized access to shared mutable state and how a design can eliminate them.
9 — Lock-Free Design
Introduces lock-free and wait-free design techniques that use atomic operations instead of locks to coordinate concurrent access.
1 — Identifying Entities
Covers how to identify entities in a domain model — objects with a persistent identity that spans changes to their attributes over time.
2 — Value Objects
Revisits value objects in the context of domain modeling, where they capture descriptive attributes of an entity without carrying identity of their own.
3 — Aggregates
Explains aggregates as consistency boundaries that group entities and value objects behind a single root for transactional integrity.
4 — Domain Services
Covers domain services for modeling operations that don't naturally belong to any single entity or value object in the model.
5 — Repositories
Introduces the repository pattern for abstracting aggregate persistence and retrieval behind a collection-like interface.
6 — Domain Events
Explains domain events as a way to capture and propagate significant state changes within a domain model to other parts of a system.
1 — Interface Design
Defines how a service's public surface is shaped so consumers depend on a stable contract rather than on internal implementation details.
2 — DTOs
Explains why data transfer objects decouple wire formats from domain models, so internal refactors don't ripple into API consumers.
3 — Validation Layers
Distinguishes syntactic, semantic, and business-rule validation so each concern is enforced at the layer best suited to catch it.
4 — Mapping Objects
Covers translating between domain models and DTOs at the API boundary without leaking persistence details or business logic across it.
5 — Pagination
Compares offset-based and cursor-based pagination strategies and how each behaves under concurrent writes and large result sets.
6 — Error Responses
Defines a consistent error response shape and status-code taxonomy so API consumers can handle failures programmatically rather than by parsing prose.
1 — Unit Testing
Covers writing isolated, fast, deterministic tests that verify a single unit of behavior without touching external dependencies.
2 — Testable Design
Explains how explicit dependency boundaries and small units of behavior make code inherently easier to exercise in isolation.
3 — Mocking
Covers using test doubles to isolate the unit under test from collaborators that are slow, external, or nondeterministic.
4 — Dependency Injection for Testing
Explains how injecting dependencies rather than constructing them internally lets tests substitute fakes without touching production code.
5 — Contract Testing
Covers verifying that a producer and consumer agree on an API or message contract without standing up the full integration.
1 — Refactoring Techniques
Surveys the catalog of small, behavior-preserving transformations used to improve code structure without changing external behavior.
2 — Identifying Code Smells
Covers recognizing structural warning signs — long methods, feature envy, shotgun surgery — that signal a refactor is due before the design breaks down.
3 — Replace Conditional with Polymorphism
Explains replacing branching type-checks with polymorphic dispatch so new cases extend the code rather than modify a growing switch statement.
4 — Extract Object
Covers pulling a cohesive group of fields and behavior out of a bloated class into a new, focused collaborator.
5 — Introduce Parameter Object
Explains grouping a repeated cluster of parameters into a single object to reduce signature churn and clarify caller intent.
6 — Builder Refactoring
Covers migrating a telescoping constructor or setter-heavy object into a builder that enforces a valid construction order.
1 — Parking Lot
Models a multi-level parking lot with heterogeneous vehicle and spot types, exercising strategy-based spot allocation and a clean split between lot, floor, and spot entities.
10 — ATM
Models an ATM's cash withdrawal, deposit, and balance-inquiry flows, exercising the state pattern across card-inserted, PIN-entry, and transaction states plus the greedy cash-dispensing algorithm.
11 — Vending Machine
Models a vending machine's product inventory, coin/payment handling, and dispensing logic, exercising the state pattern across idle, selection, payment, and dispense states.
12 — Coffee Machine
Models a coffee machine with multiple beverage recipes and shared ingredient inventories, exercising the recipe/ingredient composition model and low-stock/refill handling.
13 — Cricbuzz
Models live cricket match scoring, commentary, and scorecards, exercising the observer pattern for pushing real-time score updates to subscribed clients.
14 — Amazon Locker
Models a package-locker system for deliveries and pickups, exercising locker-size-to-package-size allocation strategy and the notification flow for one-time pickup codes.
15 — Cab Booking
Models a ride-hailing service matching riders to nearby drivers, exercising the driver-matching/dispatch strategy and dynamic surge-pricing calculation.
16 — Food Delivery
Models restaurants, menus, orders, and delivery-partner assignment for a food-delivery platform, exercising order-state-machine design and partner-assignment strategy.
17 — Notification Service
Models a multi-channel notification system spanning email, SMS, and push, exercising the strategy pattern for channel selection and template-based message rendering.
18 — Cache (LRU/LFU)
Implements an in-memory cache with fixed capacity, exercising O(1) get/put eviction design via a hash map paired with a doubly linked list for LRU or frequency buckets for LFU.
19 — Rate Limiter
Designs an API rate limiter enforcing per-client request quotas, exercising the tradeoffs between token-bucket, sliding-window, and fixed-window algorithms.
2 — Elevator System
Designs a multi-elevator dispatch system for a building, exercising the SCAN/LOOK scheduling algorithm choice and the state machine governing elevator direction and door control.
20 — Logging Framework
Designs a pluggable logging library with configurable levels, formatters, and appenders, exercising the chain-of-responsibility pattern for log-level filtering and multi-destination output.
21 — File System
Models a hierarchical in-memory file system with files and directories, exercising the composite pattern for uniform file/directory traversal and path resolution.
22 — Linux `find`
Implements a simplified version of the Unix find command over a directory tree, exercising predicate composition for filter chaining by name, type, size, and depth during traversal.
23 — Kafka-like Queue
Models a simplified publish-subscribe message queue with partitions and consumer groups, exercising partition-assignment strategy and offset-tracking for at-least-once delivery.
24 — Pub/Sub System
Models a generic publish-subscribe messaging system decoupling publishers from subscribers, exercising the observer pattern and topic-based routing/fan-out design.
3 — Library Management System
Models book catalog, members, and lending/reservation workflows for a library, exercising due-date and fine-calculation logic and the relationship between books, copies, and holds.
4 — Hotel Booking System
Models room inventory, reservations, and pricing across a hotel chain, exercising availability search and overlapping-date conflict resolution for bookings.
5 — Movie Ticket Booking
Models cinemas, shows, and seat inventory for booking movie tickets, exercising the concurrent seat-locking strategy needed to prevent double booking during checkout.
6 — Splitwise
Models shared expenses and running balances among a group of users, exercising the debt-simplification algorithm that minimizes the number of settlement transactions.
7 — Snake and Ladder
Models the classic board game with dice, snakes, and ladders for multiple players, exercising the board's jump-mapping design and the turn-based game-loop control flow.
8 — Chess
Models a full chess board, pieces, and move validation, exercising the polymorphic per-piece move-rule design and check/checkmate detection.
9 — Tic Tac Toe
Models a simple two-player grid game, exercising win-condition detection and a pluggable player strategy for human versus AI opponents.
1 — Hexagonal Architecture
Isolates core domain logic behind ports and adapters so infrastructure choices like databases or messaging can be swapped without touching business rules.
2 — Clean Architecture
Layers a system into entities, use cases, interface adapters, and frameworks so dependencies always point inward toward stable business rules.
3 — Domain-Driven Design Essentials
Introduces bounded contexts, aggregates, and ubiquitous language as the core tools for modeling complex business domains in code.
4 — Event-Driven Design
Decouples components by having them communicate through published events rather than direct calls, trading immediate consistency for looser coupling.
5 — CQRS Basics
Splits read and write models into separate paths so each can be optimized and scaled independently instead of sharing one general-purpose model.
6 — Event Sourcing Basics
Persists state as an append-only log of domain events rather than the current snapshot, letting past state be reconstructed by replay.
7 — Plug-in Architectures
Defines a stable extension point contract so third-party or optional modules can be discovered and loaded without modifying the host application.
8 — Extensible Framework Design
Covers the inversion-of-control hooks, template methods, and configuration surfaces that let a framework be extended by consumers without forking it.
1 — Memory Optimization
Examines how object layout, field ordering, and reference graphs drive per-instance memory footprint and garbage collector pressure.
2 — Object Pooling
Reuses a fixed set of expensive-to-construct objects instead of allocating and discarding them, trading extra bookkeeping for reduced allocation churn.
3 — Lazy Initialization
Defers construction of a costly resource until its first actual use, at the cost of added complexity around thread safety and null checks.
4 — Caching Strategies
Compares eviction policies, invalidation triggers, and cache placement so repeated lookups can be served without recomputation or a round trip.
5 — Efficient Collections
Matches collection data structures to their access patterns so lookup, insertion, and iteration costs stay aligned with the workload's actual shape.
6 — Profiling Object-Oriented Applications
Walks through using profilers to locate hot paths and allocation hotspots in object-oriented code before applying any optimization technique.
1 — LLD Interview Framework
Walks through the repeatable ten-step LLD interview sequence, from clarifying requirements through naming trade-offs, that anchors every chapter in this Part.
2 — Communicating During LLD Interviews
Covers how to narrate design decisions out loud during an LLD interview so the interviewer can follow the reasoning, not just the diagram.
3 — Whiteboard Design Techniques
Covers layout and sequencing techniques for sketching classes, relationships, and flows on a whiteboard (or shared doc) under interview time pressure.
4 — Common Interview Mistakes
Catalogs the recurring LLD interview failure modes — jumping to code too early, over-engineering, skipping requirement clarification — and how to avoid them.
5 — Time Management in 45–60 Minute Interviews
Breaks a 45–60 minute LLD interview into timed phases so requirement clarification, design, and coding each get a fair share of the clock.
6 — Complete Mock Interview Walkthroughs
Presents full end-to-end mock LLD interview transcripts, applying the Chapter 1 framework against representative interview prompts.
1 — Appendix A: UML Cheat Sheet
Quick-reference summary of UML notation — class, sequence, and relationship symbols — for fast lookup while sketching an LLD design.
2 — Appendix B: SOLID & GRASP Cheat Sheet
Quick-reference summary of the five SOLID principles and the GRASP responsibility-assignment patterns, condensed for interview recall.
3 — Appendix C: Design Pattern Decision Matrix
Cross-references common design problems against candidate GoF patterns so the right pattern can be picked quickly instead of pattern-matched from memory.
4 — Appendix D: LLD Interview Checklist
A pre-interview and in-interview checklist condensing the Chapter 1 framework into a single pass/fail list to run through before finishing.
5 — Appendix E: Java Implementation Guidelines
Language-specific guidance for translating an LLD whiteboard design into idiomatic Java — interfaces, access modifiers, and collection choices.
6 — Appendix F: C# Implementation Guidelines
Language-specific guidance for translating an LLD whiteboard design into idiomatic C# — properties, interfaces, and access modifiers.
7 — Appendix G: C++ Implementation Guidelines
Language-specific guidance for translating an LLD whiteboard design into idiomatic C++ — ownership semantics, virtual dispatch, and RAII.
8 — Appendix H: Go Implementation Guidelines
Language-specific guidance for translating an LLD whiteboard design into idiomatic Go — implicit interfaces, composition over inheritance, and goroutine-safe state.
9 — Appendix I: Python Implementation Guidelines
Language-specific guidance for translating an LLD whiteboard design into idiomatic Python — duck typing, ABCs, and dataclass-based value objects.
Low-Level Design for MAANG Interviews
A book-shaped table of contents for LLD interview prep: OOP fundamentals through SOLID, design principles, UML, design patterns, dependency management, reliability, concurrency, domain modeling, API design, testing, refactoring, classic interview problems, advanced architecture, and performance — cross-linking Object-Oriented Programming and Patterns instead of duplicating them.