Designing a Parking Lot: An Object-Oriented Design Interview Walkthrough

"Design a parking lot" is the classic object-oriented design question. There is no single right answer; the interviewer watches how you clarify, model, and extend.

Clarify first

Ask about vehicle types (motorcycle, car, bus), spot sizes, multiple floors, payment, and whether you need entry/exit gates. Write the assumptions down.

Core classes

Key methods

park(vehicle) -> Ticket, leave(ticket) -> fee, and available_spots(size). Keep a free-spot set per size per floor so lookup is O(1) instead of scanning.

Extensions interviewers ask for

Pricing strategies (use a strategy interface), reservations, a display board showing free spots (observer pattern), and concurrency when two cars grab the same spot (lock per spot or atomic compare-and-set).

Common mistakes

Jumping into code before agreeing on requirements, and putting all logic in one giant class. Keep responsibilities small. More interview prep at linkjob.ai.

Disclosure: I work on Linkjob AI.