Lot with parking spaces for vehicles
Lot will have a way to enter and exit
Lot will accommodate for different vehicle types.
Security, fast way for people to park, efficient structure.
Estimate the scale of the system you are going to design...
Medium-sized parking lot, 250-500 vehicles.
May need outside systems/APIs to help with any payment we want to consider for the garage. For example, ticket machines that can handle card payment, mobile payment and also cash payment.
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
Our database will consist of the 200-500 spaces we have. We can track if these spaces are filled or not, what time the space was filled, and note the vehicle that has filled the spot.
We may also use a database to manage tickets, which will be used with the enter and exit gates. We can use some database to contain ticket IDs and times.
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
We will have several components to manage the garage.
We will have:
Entry management - incoming vehicles and create tickets
Exit - validate payment and update availability
Parking spots - assign spaces (doesn't have to be specific spaces) and maintain various vehicle types
Payment - handle transactions with ticket machines
Analytics - data visualization, keep track of data for efficient management
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
When a vehicle arrives, we will ensure they grab a ticket before they can enter. We will log the ticket and the time the vehicle had arrived.
The vehicle will find whatever open spot they can of their vehicle type.
When the vehicle leaves, they will have to insert their ticket into an exit ticket machine. It will check when the vehicle had arrived, calculate the duration of their stay, process any payments, and then allow the vehicle to leave. If the vehicle lost their ticket, they would pay the capped amount for a day.
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
For the parking spot component, we can just mark if a space is occupied or not. There's many parking garages that use a light to indicate open spots, green for open spot and red for closed spot.
For the structure, we will ensure things like handicap spots will be positioned closer to the shopping mall. The parking lot will surround the mall so that visitors can park near the stores they want to visit.
When a vehicle enters and a ticket is generated, we save a ticket ID and the time.
When a vehicle exits, we will check the time the ticket was generated and compare it to when the vehicle is leaving. If the time has exceeded 30 mins, we will have to process a payment, so the vehicle will not be allowed to leave until the payment is finished.
Explain any trade offs you have made and why you made certain tech choices...
I want the parking lot to surround the mall, instead of having some kind of multi-layer garage so that visitors can park close to the stores that they want to visit in the mall. We can add multi-layer garages next to the most popular parts of the mall, or most visited stores.
Try to discuss as many failure scenarios/bottlenecks as possible.
Some bottlenecks would be the number of entrances and exits. Many people may go in and out of the mall at a time, and we would need several entrances/exits in order to prevent traffic. Traffic in the parking lot is a common event, especially when many people try to leave at the same time (before a mall closes).
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?
We can make multi-level garages near popular parts of the mall, that way more people can park in certain spots instead of spots all over the mall.
We can also change how many entrances and exits work at a time. For instance, we could disable some during slow times, and open more when there's a lot of people visiting at a time.