Deep Dive
low level designoopdesign patterns

Designing a Parking Lot: A Low-Level Design Walkthrough

A complete object-oriented design for a multi-level parking lot — the class model, pluggable spot-allocation and pricing strategies, an O(1) availability lookup, a live simulator you can drive cars into, and a codeable interface you can implement against.

·30 min read
Medium

The parking lot is the interviewer’s favorite LLD warm-up — not because garages are interesting, but because a good design reveals whether you instinctively separate concerns, reach for interfaces, and keep behaviour out of storage classes.

Nail the requirements first

Pin down what “done” means before a single class. The functional/non-functional split is what separates a design that works from one that survives change.

Functional
  • Vehicle enters → gets a fitting spot → receives a ticket
  • Vehicle exits → fee computed → spot freed → ticket closed
  • Reject entry when lot is full for that vehicle size
  • Spot sizes and level count are configurable
Non-functional
  • Allocation strategy is pluggable (nearest, best-fit, …)
  • Pricing strategy is pluggable (flat, tiered, surge, …)
  • Availability check is O(1) per size — not a full scan
  • Adding EV spots or a new level requires no rewrite

The members-only walkthrough picks up from here: a live simulator you can drive cars into and toggle allocation strategies on, the full class model behind a labelled diagram, the O(1) availability trick, the pluggable allocation and pricing strategies with their code in Java, C++, and Python, the codeable interface you implement against, and the interview corner with edge cases and a practice challenge.

Members only

Keep reading with Premium

You've reached the members-only part of this deep-dive — the full implementation, the interactive ring simulator, and the step-by-step walkthrough. Unlock it with a membership.

Related Articles