Approaching an LLD Problem: Requirements, Entities and UML
Follow a repeatable method for LLD rounds: clarify requirements, find entities and relationships, draw class and sequence diagrams, then code the core.
Intermediate · about 3 hours · difficulty 2/5
Learn first: Design Patterns for LLD
Most LLD failures come from starting to code too early. A repeatable method keeps you calm and makes your design easy to follow.
A step-by-step method
- Clarify requirements (5 minutes): which features are in scope? For a parking lot: multiple floors? vehicle types? payments? Write them as a short list.
- Identify entities: nouns in the requirements become candidate classes (ParkingLot, Floor, Spot, Vehicle, Ticket, Payment).
- Define relationships: association, aggregation, composition ("a Floor has Spots"), inheritance only where it is a genuine "is-a".
- Define behaviour: verbs become methods (parkVehicle, unpark, calculateFee). Decide which class owns each method.
- Apply patterns where variation exists (fee rules as Strategy, spot allocation as Strategy, ticket state as State).
- Handle concurrency: two cars grabbing the same spot, two users booking the same seat.
- Code the core flow with clean interfaces and a small driver or tests.
UML you actually need
- Class diagrams: classes, key fields and methods, relationships with multiplicity (1 to many).
- Sequence diagrams: the order of calls for the main use case.
- Optionally an enum list and a state diagram for objects with a lifecycle.
Draw them quickly; tools like Mermaid, PlantUML or Excalidraw are fine for practice.
What interviewers look for
Clear separation of concerns, extensibility for the obvious next requirement, correct handling of edge cases and concurrency, readable naming, and the ability to explain trade-offs.
Pitfalls
- God classes (a ParkingLotManager that does everything).
- Modelling every noun as a class, including ones with no behaviour.
- Ignoring concurrency until the interviewer asks.
You are ready to move on when you can take a fresh prompt such as "design a library management system" and produce a requirement list, class diagram and sequence diagram in 20 minutes.
Key concepts
- Clarifying LLD requirements
- Finding entities and relationships
- Class diagrams
- Sequence diagrams
- State diagrams
- Concurrency considerations
- Mermaid or PlantUML
Mini project
Design a library management system end to end: requirements list, class diagram and checkout sequence diagram in Mermaid, then implement the core classes with an in-memory store and a small test suite.
Check yourself
What is the difference between aggregation and composition, and which one describes the relationship between a ParkingFloor and its ParkingSpots?
Free resources
- UML diagrams reference (uml-diagrams.org)
- Mermaid class diagrams and more (Mermaid)
- Awesome Low Level Design (GitHub)