Low Level Design of a Parking Lot

ยท

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

ย