Topic 3.1
Requirement Analysis
In one line
Given a problem like Parking Lot, you must enumerate the actors, objects, rules, and edge cases before any code — this is the difference between a designer and a coder in an interview.
Think of it like this
A tailor taking measurements before cutting cloth. A tailor who starts cutting before asking 'shirt or kurta? slim or loose? for which occasion?' wastes the cloth. Asking first is the job, not a delay.
Key ideas
- 01
Ask/derive: vehicle types (car, bike, truck, EV?), number of floors, spot types, pricing model, entry/exit gates, payment methods, ticketing, concurrency needs.
- 02
Functional questions you can answer in one pass: who enters, who pays, who leaves, what breaks?
- 03
Non-functional questions: how many cars/hour (QPS), per-floor capacity, acceptable checkout latency.
- 04
Document 3–5 core use cases verbatim: 'car arrives at gate → gets ticket → parks → pays at exit → leaves'.
- 05
List the edge cases immediately: full lot, same car enters twice, ticket lost, payment timeout, gate blocked.
- 06
Interview gold: enumerate assumptions out loud before designing ('I'll assume hourly pricing + prepaid + postpaid').
Java / Spring map
- →
Spring Boot DDD-style: bounded context for parking = ParkingContext with its own models.
Code & diagrams
A filled-in requirements sheet. Write this on the board in the first 3–5 minutes.
ACTORS Driver, Gate attendant (optional), Admin, Payment system
IN SCOPE 1. Vehicle enters → gets a ticket with an assigned spot
2. Vehicle exits → pays → spot is freed
3. Admin adds floors / spots, changes prices
4. Display board shows free spots per floor and type
OUT SCOPE Online pre-booking, monthly passes, valet (mention, then park it)
RULES • Spot types: SMALL (bike), MEDIUM (car), LARGE (truck), EV
• A bike may use a bigger spot if small ones are full; a truck never uses a small one
• Pricing: first 30 min free, then hourly; rate depends on spot type
• One active ticket per number plate
EDGE CASES • Lot full → reject at entry, show "FULL"
• Two gates try to give away the last spot at the same moment (concurrency!)
• Lost ticket → charge the daily maximum
• Payment fails → gate stays closed, allow retry
• Same car enters twice → reject the second entry
NON-FUNC • 5 gates, ~2,000 vehicles/day, ticket issued in < 1 s
• Must be correct under concurrent entries (no double-assigned spot)
ASSUMPTIONS "I'll assume one building, card/UPI/cash payment at exit,
and hourly pricing. Shout if you want something different."Explain without notes
Do Parking Lot requirements in 90 seconds without notes — actors, objects, rules, edge cases.
Practice
Write requirement lists for Vending Machine and Library Management using the same skeleton.
Completion checklist
I can produce a requirements list for any given LLD problem in under 3 minutes.