Command Palette

Search for a command to run...

PHASE 3Intermediate ~8 min· topic 1 of 7

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.

0/7 · 0%

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

  1. 01

    Ask/derive: vehicle types (car, bike, truck, EV?), number of floors, spot types, pricing model, entry/exit gates, payment methods, ticketing, concurrency needs.

  2. 02

    Functional questions you can answer in one pass: who enters, who pays, who leaves, what breaks?

  3. 03

    Non-functional questions: how many cars/hour (QPS), per-floor capacity, acceptable checkout latency.

  4. 04

    Document 3–5 core use cases verbatim: 'car arrives at gate → gets ticket → parks → pays at exit → leaves'.

  5. 05

    List the edge cases immediately: full lot, same car enters twice, ticket lost, payment timeout, gate blocked.

  6. 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

ParkingLotRequirements.mdmarkdown

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

01

Do Parking Lot requirements in 90 seconds without notes — actors, objects, rules, edge cases.

Practice

01

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.

Back to phase