The low-level design interview: a step-by-step approach
A repeatable way to answer 'Design the classes for X' (a parking lot, an elevator, Splitwise) and write the key code.
Why it matters
LLD questions are open-ended: 'design a parking lot' could mean almost anything. Without a method you write random classes, or code that breaks the moment the interviewer adds a requirement.
The idea
Low-level design (LLD) tests object-oriented design: clear classes, good relationships, sensible patterns, and code that is easy to extend. Clarify the scope, list the entities, draw a class diagram, pick patterns where things vary, code the main flows, then discuss concurrency and how you'd add new features.
Planning a kitchen before building it: decide which stations you need (classes), who passes what to whom (relationships), and only then build the cupboards (code).
A kitchen is built once. A software design keeps changing, so interviewers will add a new requirement ('now add electric-car charging') to see if your design bends instead of breaks.
How it works
- Clarify: write 4–6 use cases as short sentences ('a car enters', 'the system assigns a spot', 'the driver pays on exit'). Agree what's out of scope.
- Find the entities: underline the nouns in the use cases (car, spot, ticket, payment). They're your candidate classes. The verbs (assign, pay) become methods.
- Draw the class diagram: fields, key methods and relationships. For each relationship ask: is it 'is-a' (inheritance) or 'has-a' (composition)?
- Spot what varies: pricing rules, vehicle types, payment methods. Put each behind an interface (Strategy, Factory or State).
- Code the main flow, such as park() and leave(), with clear names, and show how the classes call each other.
- Stress-test it: two cars at two gates at the same moment (concurrency), a lost ticket (an edge case), and 'now add electric charging' (an extension). Say what changes.
Example
Parking lot: clarify (floors? vehicle types? payment?), list entities (ParkingLot, Floor, Spot, Vehicle, Ticket, Payment), draw relationships, use Strategy for pricing and spot assignment, code park() and leave(), then explain how two gates avoid giving out the same spot.
Key points
- 1. Clarify requirements and scope: the main use cases, what's out of scope.
- 2. Identify entities (nouns) and actions (verbs) from the use cases.
- 3. Draw a class diagram: fields, methods, relationships (composition, inheritance, interfaces).
- 4. Apply patterns where behaviour varies: Strategy, State, Factory, Observer.
- 5. Code the core flows with clean names; skip trivial getters.
- 6. Discuss concurrency (two users at once), edge cases and extensibility.
- Use SOLID to justify your choices out loud.
Common mistakes
- One giant class (a 'god class') that does everything.
- Deep inheritance trees where composition would be simpler.
- Using patterns that don't fit, just to mention them.
- Ignoring concurrency when two users can act on the same thing.
Not true: Inheritance is the first tool to reach for when two classes share code.
In fact: Deep inheritance trees are rigid and hard to change. Composition, where a class holds another object and uses it, is often simpler.
Not true: One big class holding the whole design is easy to extend later.
In fact: A class that does everything (a 'god class') is hard to change, because each change risks all the rest. Give each class one job.
In the interview
I'll confirm the use cases first, then pull the main entities out of them and sketch a class diagram. Where behaviour is likely to change, like pricing, I'll put it behind an interface. Then I'll code the core flow and finish with concurrency and how the design extends.
Part of Unit 0: How system design interviews work in the free System Design course.