System requirements


Functional:

  • Allow for user creation to store their payment information and car details
  • Let users know if there is vacancy
  • Allow vehicles to enter a garage when there is space
  • Allow vehicles to leave, and get payment for time
  • Remove cars that have been present for too long


Non-Functional:

Users should be able to quickly know if a parking spot is available, and be able to quickly get a spot if one is open


Should balance out space allocations to prevent traffic within a parking garage


Should allow cars to enter and leave simultaneously to prevent back-up on the street




Capacity estimation

Estimate the scale of the system you are going to design...


Bursty Traffic, thousands of reads and hundreds of writes at certain times of day





API design

getVacancy() - returns true if parking lot has a vacancy


postCar(car/User) - attempts to add car to parking lot, request fails if there is no vacancy, and if it succeeds returns parking spot


deleteCar(car, paymentInfo) or (user) - attempts to remove car from parking lot, fails if car is not in lot, or payment info is incorrect.


postUser(name, car, paymentInfo) - user creation, can submit a car and payment info for quick payments and spot allocation






Database design

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...


Store 3 SQL tables


One for parking spots, mapping spot IDs to foreign car and foreign user keys. Also stores the level of the parking garage, and the time at which the spot was taken


A car table containing lisence plate, make, model, color, and foreign userID, and foreing spot ID


User tables contaning UserID, name





High-level design

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...


User management will handle new user creation, and adding cars for a user.


The space management service will determine whether or not there is space in a parking lot, and add, remove cars from the parking lot


There is also a payment service for handleing payments






Request flows

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...






Detailed component design

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...


Space management will assign available parking spots, selecting spots randomly from levels of the parking lot, choosing the level with the least number of cars presently parked there in order to avoid traffic


The server determines due payment by checking was the current time is, and how long the user held the space. Will then return a payment request to the user.







Trade offs/Tech choices

Explain any trade offs you have made and why you made certain tech choices...






Failure scenarios/bottlenecks

Try to discuss as many failure scenarios/bottlenecks as possible.






Future improvements

What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?


Can be scaled for multiple parking lots, distributing the space management service for multiple space databases while still maintaining a single user database and service.