Low Level Design of a Parking Lot

Paras kaushikParas kaushik
2 min read

In this blog, we will discuss how would we model a parking lot software by an object-oriented design

Requirement Gathering

  • The Vehicle enters the Parking Lot via the Entrance Gate, gets a parking ticket, for a parking spot

  • The ticket is specific to its vehicle type i.e. wheelers, three wheelers or four wheelers and others (for more wheels)

  • and then eventually after spending some time, exits via the exit gate

  • At the exit gate payment has to be done, this can be hourly based for some parking spots and minutes based for other

  • We assume only one entrance and one exit (a follow-up can be multiple entrances and multiple exits -in which can for each entrance the parking spot has to be found smartly ie nearest to the entrance, nearest to the lift if its heavy vehicle it should be near to the warehouse )

  • We assume only one floor is there

Objects Identification- Bottom Up

  • Vehicle(abstract), vehicle type(enum)

  • Parking Spot, ID, isEmpty, Vehicle, Price, type

  • To manage our ParkingSpots we have a ParkingSpotManager

  • ParkingSpotManager uses a ParkingStratergy to assign a parking Spot

    • Ticket object

  • Entrance Gate finds parking space and updates parking space, generates a ticket

  • Exit Gate, cost calculation, payment, update parking spot

UML

0
Subscribe to my newsletter

Read articles from Paras kaushik directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Paras kaushik
Paras kaushik

Hello, I'm Paras Kaushik! ๐Ÿ‘‹ I'm a dedicated software engineer based in India, specializing in C++ and proficient in the MERN stack. ๐Ÿค Interested in collaborating on innovative projects that require my technical expertise. ๐Ÿ’ฌ Passionate about participating in discussions related to software architecture and best practices. ๐Ÿ“ง Feel free to reach out to me via email: [paraskaushik12@gmail.com] ๐Ÿ”— Connect with me on LinkedIn: [https://www.linkedin.com/in/the-paras-kaushik/]