What LLD Interviews Actually Test
You'll learn to
- -Tell High-Level Design from Low-Level Design using one example, a parking lot
- -Name the four things an LLD interviewer grades, and what each one looks like in an answer
- -Know what you hand over at the end of an LLD round: a class diagram and working code for the core classes
Tip: the highlighter is on - just select any text below to mark it. Use the highlighter button up top to change color or turn it off. Highlights are saved on this device only. Log in to save them to your account instead.
Suppose a company asks you to design the software for a parking lot. That one sentence hides two very different questions. The first is about scale: 10,000 lots across the country each report every car that enters and leaves, so which servers, databases and queues handle all that traffic? The second is about structure: inside the software for a single lot, what are the pieces, what is each piece responsible for, and how do they talk to each other?
The first question is High-Level Design (HLD): how the big parts of a system, such as servers, databases, caches and queues, connect so that it handles many users. The second is Low-Level Design (LLD): how the code inside one of those parts is organized into classes. A class is a blueprint that bundles some data with the actions that use that data. This chapter is about telling the two apart, because the preparation for each is different.
An Analogy: The City Map and the Floor Plan
HLD is the city map. It shows roads, districts and bridges, and it answers whether the city copes with a million commuters. LLD is the floor plan of one building. It shows rooms, doors and which room is used for what, and it answers whether the building is pleasant to live in and easy to extend. A city planner and an architect are both doing design, but nobody expects the architect to draw the motorways.
HLD and LLD, Side by Side
- -HLD scope: the whole distributed system, with its services, data stores, network boundaries and the millions of users who hit them.
- -LLD scope: the inside of one component. It lives in a single process, so there are no load balancers to draw.
- -HLD deliverable: a box-and-arrow architecture diagram with capacity numbers.
- -LLD deliverable: a class diagram, real method signatures and working code for the core classes and how they interact.
The sketch below is the flavor of an LLD answer to the parking-lot prompt. Nothing here talks about servers. It only names the pieces and what each one can do.
class Spot:
def is_free(self) -> bool: ... # a spot knows if a car is in it
class Ticket:
def __init__(self, spot, entered_at): ... # remembers where and when
class ParkingLot:
def park(self, vehicle) -> Ticket: ... # finds a free spot, returns a ticket
def leave(self, ticket) -> int: ... # frees the spot, returns the feeThe Grading Rubric
Interviewers are not checking whether you memorized the names of design patterns. A design pattern is a named, reusable answer to a common design problem, cataloged in a well-known 1994 book by four authors called the Gang of Four. What the interviewer actually watches for is these four things.
- -Clarity: you ask questions before you draw anything. For the parking lot, that is how many floors, whether motorcycles may use car spots, and whether payment happens on exit.
- -Responsibility: each class has one clear job, so you can say in a sentence what it is for.
- -Extensibility: your design survives a follow-up such as "now add electric-vehicle charging spots" by adding code rather than rewriting it.
- -Communication: you explain your choices out loud and you can defend them.
Take the follow-up about charging spots. In a good design you add one new kind of spot that offers the same actions as the others, and the rest of the program does not notice. In a weak design you open every method that touches a spot and add a check for electric cars. That is the difference interviewers are looking for. A design with zero named patterns that gets all four right beats one that name-drops five patterns and collapses at the first follow-up.
The most common way to fail an LLD round is not bad code. It is skipping the clarifying questions and designing the wrong thing perfectly. Five minutes of questions at the start saves the whole round.
An interviewer opens with "Design a parking lot." What is the first thing you should do?
"Okay, so we'll need a ParkingLot class, a Spot class, and a Vehicle class..." (starts drawing classes immediately)
"Before I design anything - what types of vehicles do we support, does the lot have multiple levels, do we need to handle payment, and are we optimizing for fast spot assignment or simplicity? I want to make sure I'm solving the actual problem before I commit to a class structure."
What is the primary difference in scope between an HLD and an LLD interview?
Discussion0
Join the Discussion
Sign in to leave comments, reply to others, or like insights.
No comments yet. Be the first to start the thread!