A Framework for the OOD Interview

Easy
FundamentalsInterview Prep

The LLDCode Interview Framework

Use this systematic approach for every LLD/machine coding interview.

Step 1 — Requirements Clarification (5 min)

Ask these questions for any system:

  • Who are the users/actors?
  • What are the core use cases (not edge cases)?
  • What scale/constraints should I assume?
  • What should I explicitly NOT design? (define scope)

Example for Parking Lot:

  • "How many floors/spots?" → "Assume 3 floors, 30 spots each"
  • "What vehicle types?" → "Cars, motorcycles, trucks"
  • "Do I need payment processing?" → "No, just fee calculation"

Step 2 — Identify Core Entities (5 min)

Look for nouns in the requirements → these become classes.

"A parking lot has multiple levels. Each level has spots of different sizes. Vehicles enter and receive tickets."

Entities: ParkingLot, Level, ParkingSpot, Vehicle, Ticket

Step 3 — Define Relationships (5 min)

  • Inheritance (IS-A): Car IS-A Vehicle
  • Composition (HAS-A, strong): ParkingLot HAS Levels (levels can't exist without lot)
  • Association (HAS-A, weak): Ticket HAS Vehicle reference
  • Dependency (USES): ParkingLot USES FeeCalculator

Step 4 — Identify Design Patterns (2 min)

| Clue in Requirements | Likely Pattern | |---------------------|----------------| | "Only one instance" | Singleton | | "Different algorithms" | Strategy | | "State-dependent behavior" | State | | "Notify multiple objects" | Observer | | "Create objects by type" | Factory | | "Tree structure" | Composite |

Step 5 — Define Public API (3 min)

Before writing implementation, write the method signatures:

class ParkingLot {
    ParkingTicket parkVehicle(Vehicle v);    // returns null if full
    double unparkVehicle(ParkingTicket t);   // returns fee
    int getAvailableSpots();
}

Step 6 — Implement Core Classes (25 min)

Priority: core logic first, edge cases after.

Step 7 — Test & Walk Through (5 min)

Walk through a key scenario verbally with test data.

!Constraints

No coding required — internalize this framework. Apply it to every subsequent problem on this platform.
Output

Run your code to see output here.