What an LLD interview tests
easy 40 minA low-level design round gives you one vague sentence and about 45 minutes.
Video lesson · Chapter 1 of 6
Make a prediction
What an LLD interview tests
1:05Reel
Theory
Read or listen first. About 2 min.
What it is
A low-level design interview (LLD, also called object-oriented design) asks you to design the inside of one program: classes, what each class knows, what it does, and how the objects talk to each other. Often you write the main methods as real code.
The prompt is short on purpose: a parking lot, a chess game, a bike share station. Missing details are part of the test. So are the rules that nobody mentions, such as two people who want the last bike.
The program usually runs in one process and in memory. No servers, no load balancer, no database schema, unless the interviewer asks. That is the line to system design.
Why it exists
Most daily work is not a puzzle with a clever trick. It is a change to a program that other people also change. The round looks at exactly that: can you split a problem so that the next change stays small?
It also shows how you work with people. You ask, you decide, you say why, and you react when somebody finds a hole. A finished answer without reasons shows less than a smaller answer that you can defend.
Remembered solutions help only while the prompt is the remembered one. The first follow-up question ends that. A way of working fits a vending machine, a chess board and a control room alike, because all of them have things, owners, rules and states. The details still differ, and you must look at them.
A short history
1989
Kent Beck and Ward Cunningham present CRC cards at OOPSLA: one paper card per class with its responsibilities and collaborators. It is still the fastest way to talk a design through.
1994
Design Patterns by Gamma, Helm, Johnson and Vlissides gives names to 23 recurring designs. Interviewers and candidates use these names as a short language.
1997
The Object Management Group adopts UML 1.1 in November. Class diagrams get one common notation.
Words to know
- Prompt
- The one or two sentences you get at the start.
- Scope
- What you agreed to build, and what you agreed to leave out.
- Entity
- A thing in the problem with its own identity or rules, such as a bike or a ride.
- Responsibility
- Something one class promises to know or to do.
- Invariant
- A statement that must always be true, such as: a bike has at most one rider.
- Policy
- A rule that is expected to vary, such as the price.
- Lifecycle
- The states a thing goes through, and the moves that are allowed.
- Trace
- Walking through your code by hand with concrete values.
- Follow-up
- A new requirement near the end, to see what your design does with it.
How it works
Step through the idea, or press Play.
Ask. Turn one sentence into a short list
Understand it
Start here
A chair, please
Noor walks into the workshop of Sam, who builds furniture, and asks for a chair. What Sam does in the next minutes is the whole interview.
Frame 2 is the most common way to fail: good work on the wrong chair.
The test
Five things they look at
The score sheet behind the questions
Scope
Did you find the missing rules, and agree on what to leave out?
Owners
Does every fact and every rule live in one class that you can name?
Correctness
Does the code keep its invariants, also in the strange cases?
Change
When a new rule arrives, how many classes do you open?
Talk
Can a listener follow you, interrupt you and get a reason?
Companies use their own sheets and words. These five are our summary of what a design round can show at all. Ask your recruiter which format you will get.
Where each signal appears
The border
LLD is not system design
The same product, two rounds
| Low-level design | System design | |
|---|---|---|
| Unit | Classes and methods | Services, stores and queues |
| Runs on | One process, unless told otherwise | Many machines |
| Bike share | Who may start a ride? What happens at a full station? | How do 10,000 stations report their state? |
| Numbers | How many threads, how many items in memory | Requests per second, bytes per day |
| Two at once | A lock around check and change | A transaction or a conditional write |
| Result | A class diagram and working code | An architecture and its trade-offs |
| Typical miss | Drawing load balancers | Listing private fields |
One sentence moves you to the right side: I assume one process and in-memory data, with several threads. Is that right? If they want a city-wide system, the round has changed, and you ask which part they want to see.
Which round am I in?
Formats
Four shapes of the round
| Format | Typical length | You hand over | Spend more on | Spend less on |
|---|---|---|---|---|
| Talk and diagram | 35 to 60 min | Classes, relations, method names | Owners, reasons, follow-ups | Syntax |
| Design and code | 45 to 60 min | A sketch and the main methods | The core path, a trace | Getters, menus, printing |
| Build and run | 60 to 120 min | A program that runs, often with tests | A small end-to-end version early | Rare patterns |
| Take home | Hours to days | A repository with a README | Tests, names, a short decision list | Extra features |
Two ways to prepare
Memorize forty answers, or learn one method
One way of working
- One order of steps for every prompt
- The same five questions find the parts
- A variation changes one part
- A step you practised often still works when you are nervous
Remembered solutions
- Forty designs to keep alive
- A new prompt leaves you with nothing
- A follow-up does not fit the remembered picture
- Under pressure the details are the first to go
Practice problems still matter. Solve them to train the method, then throw the solution away and solve them again with a changed rule.
The lens
Things, rules and states
Many LLD prompts share one shape. A container holds items. A manager takes the requests and keeps the two consistent. Some rules vary, and we call them policy. Some things go through states, and we call that lifecycle.
The common shape, on a bike share
1/5C: container
What holds things? A Station has a limited number of docks. The limit is a rule, so it needs an owner.
has (lives on)uses
C.I.M.P.L., said like simple
- 1
Container: what holds the resources?
A board, a lot, a shelf, a map. Look for a capacity or a position.
- 2
Item: what is the resource?
A piece, a car, a book, a cache node. Look for identity.
- 3
Manager: who takes the request?
A controller, a game, a service. Look for a rule that spans several objects.
- 4
Policy: what logic varies?
Pricing, dispatch order, payment method, eviction. When you hear several ways to do X, think of Strategy, or of a plain value if only a number differs.
- 5
Lifecycle: which states exist?
Idle to active to complete, available to occupied, pending to processing to done. When behaviour changes with status, think of State. When only a check changes, an enum and a table are enough.
The bike's lifecycle
The lens on two more prompts
| Library | Food delivery | |
|---|---|---|
| Container | Shelf, section | Restaurant menu |
| Item | Book copy | Dish, order |
| Manager | Lending desk | Order service |
| Policy | Lending rules: how long, how many | Delivery fee, discounts |
| Lifecycle | On shelf, borrowed, returned | Placed, cooking, on the way, delivered |
| Neither | A member is an actor, not a held item | A courier is an actor with an own lifecycle |
A weak answer
It runs, and it fails the round
Same prompt: people take a bike at one station and return it at another. Here is an answer that many write in the first five minutes. Read it as the interviewer does.
The weak shape: one class, no owners
1/2One class
BikeSystem has public maps and one method for everything. No class is called Ride, so nobody owns the rule: one rider per bike.
uses
What the interviewer sees
Short and quick to write. Each beat is a note on the score sheet.
class BikeSystem: def __init__(self): self.bikes = {} # id -> [status, station, rider, start] self.capacity = {} # station -> docks def action(self, kind, rider, station, bike, now): b = self.bikes[bike] if kind == "start": b[0] = "riding" b[2], b[3] = rider, now return None if kind == "finish": minutes = now - b[3] b[0], b[1] = "docked", station return minutes * 20Lines 3 to 4
Facts are stored as positions in a list. b[2] has no name, so a reader must remember that it is the rider. Public too: any caller can change it.
A strong answer
The same prompt with owners
Agreed scope: take a bike at a station, return it at any station with a free dock, pay by the minute after a free time, one ride per rider, several screens at once. Out: payment, reservations, maps.
Bike share, from the item upwards
Start with the class that depends on nothing. It can be read and tested alone.
from dataclasses import dataclassfrom enum import Enumfrom threading import Lockfrom typing import Protocolclass BikeState(Enum): DOCKED = "docked" RIDING = "riding" REPAIR = "repair"class Refused(Exception): """A rule said no. The caller can show the reason."""_NEXT = { BikeState.DOCKED: {BikeState.RIDING, BikeState.REPAIR}, BikeState.RIDING: {BikeState.DOCKED}, BikeState.REPAIR: {BikeState.DOCKED},}class Bike: def __init__(self, bike_id: str): self.id = bike_id self._state = BikeState.DOCKED @property def state(self) -> BikeState: return self._state def move_to(self, new: BikeState) -> None: if new not in _NEXT[self._state]: raise Refused(f"{self.id}: {self._state.value} to {new.value}") self._state = newLines 7 to 10
Three states with names. A wrong state is now a typo that fails, not a silent string.
A refused return
The interviewer asks: now we sell a day pass. What do you change?
BreaksA flag in finish
- How
finish(..., has_pass)with a branch for the fee.- Limit
- Every screen must know about passes, and the next offer is another flag.
- Choose when
- Never.
WorksA second PricingRule chosen per rider
- How
- The service asks a
PricingBookfor the rule of this rider. - Limit
- One more class. The choice must be made at the start of the ride, or a pass that ends during it changes the price.
- Choose when
- Two or three offers.
StrongThe ride keeps its rule
- How
startpicks the rule and stores it inRide.finishasksride.pricing. New offers are new rules.- Limit
- The ride gets one more field, so old rides need a default.
- Choose when
- Prices that change over time. You also say what stays: bike, station, lock.
Scoring
How the notes become a result
Four signals, weak to strong
| Signal | Weak | Enough | Strong |
|---|---|---|---|
| Scope | Starts at once | Asks, writes a list | Finds the rule that decides the design, and cuts scope aloud |
| Owners | One class or thirty | Each class has one job | Can say for every rule who keeps it, and which nouns were rejected |
| Correctness | Happy path only | Handles refusals | Names invariants, traces a race, fixes a bug alone |
| Change | Rewrite | One class and some edits | Shows the lines that stay, and refuses abstractions nobody needs |
| Talk | Silent or a speech | Explains choices | Gives reason and cost, and uses hints at once |
A bug is not a fail. A bug that you find in your own trace is often a plus. A hint is not a fail either. A hint that you argue away without thinking is.
The same minute, two candidates
Interviewer
Two people tap start at the last bike at the same moment.
You
Weak: that will probably never happen. Strong: good case.
startholds the lock while it takes the bike and records the ride. The second call finds no bike and gets a refusal. Let me trace it with one bike and two riders.Interviewer
Would you put the lock into the bike?
You
A lock in the bike protects one bike. My rule is about a rider, a bike and a station together, so the lock belongs to the class that sees all three.
Where the points leak
Plan
How to prepare with this course
- 1
Learn the order
The 5-step execution flow gives you a clock. Practise with a real timer.
- 2
Train each step alone
- 3
Know few patterns well
Strategy, State, Observer, Factory and Decorator cover much. Learn when not to use each.
- 4
Solve, change, solve again
Take parking lot. Next day solve it again with one changed rule.
- 5
Talk aloud
Record five minutes. If you cannot hear a reason after a decision, add the word because.
Summary
The whole topic in one minute.
The round scores five things: agreed scope, clear owners, correct code, a design that takes change, and talk that another person can follow.
C.I.M.P.L. is a way to look at a prompt: container, item, manager, policy, lifecycle. It finds candidates for classes. Your requirements decide which of them stay.
- One vague sentence, about 45 minutes, one process: classes, code, proof, change.
- Five signals: scope, owners, correctness, change, talk.
- C.I.M.P.L. finds candidates: container, item, manager, policy, lifecycle.
- Policy can be a value, lifecycle can be an enum. Patterns must earn their place.
- Say each invariant and name the class that keeps it.
- Check and change under one lock, or say that there is one thread.
- A found bug and a used hint are good signs.
Sources
- Beck and Cunningham: A Laboratory for Teaching Object-Oriented Thinking (1989)
- Design Patterns (1994), overview
- Unified Modeling Language, history
- Python: logging
- Java: ThreadPoolExecutor
- HikariCP
- Caffeine: eviction
- python-chess: core
- Kubernetes: Pod lifecycle
- SQLAlchemy: state management
- Django: password management