KatInterview

Object-Oriented Design for a Multi-Story Parking Facility

System DesignModel answer
MediumModel answerSystem Designobject-oriented-designdata-structure-designconcurrency

Last updated

Design an object-oriented domain model for managing multi-story parking structures, handling real-time spot assignment, pricing strategies, and concurrency control.

Design an object-oriented domain model and core architecture for managing a multi-story automated parking facility.

The system must handle:

  • Structures with multiple floors, each containing various parking spot configurations.
  • A variety of vehicle classifications (e.g., motorbikes, sedans, oversized delivery vans, and electric vehicles).
  • Distinct spot types (e.g., motorbike, compact, oversized, accessible/handicapped, and EV charging stations).
  • Full life-cycle tracking: vehicle arrival, ticket generation, automated spot assignment, vehicle departure, dynamic fee evaluation, and spot release.
  • Immediate query capability for current available capacity grouped by spot type.

Detail the core domain objects, their structural relationships, chosen data structures, and operational algorithms. Address how your design handles spot matching strategies, extensible fee calculations, and thread safety across concurrent entry/exit gates.

Hints

Hint 1

Decouple immutable vehicle attributes and transient parking spot allocations from ticket lifecycle tracking.

Hint 2

Consider indexing available spots per type using a priority queue (min-heap) ordered by floor level to optimize entry throughput while guaranteeing optimal spot placement.

Hint 3

Use strategy patterns for pricing rules and vehicle-to-spot matching to allow changes without altering core garage logic.