Skip to content

Ayush0316/Parking-Lot-System--LLD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

ParkingLot

Design a low-level system for a parking lot that satisfies the following requirements:

  1. The parking lot should have multiple entrances and exits.
  2. A global display board should show the number of free parking spots of all types.
  3. The parking lot should have different types of parking spots (mini, compact, and large) that allow parking for motorbikes, cars, and trucks, respectively.
  4. The parking lot should have multiple floors.
  5. The admin should be able to add and remove entrances and exits.
  6. The parking attendant should be able to create parking tickets.
  7. The parking lot should support different means of payment.

Please provide a detailed low-level design for the parking lot system that can handle the above requirements. You should consider how the parking lot will handle incoming and outgoing vehicles, track parking spots, generate and process parking tickets, and manage payments. Additionally, you should consider how the system will communicate with the display board and handle different parking strategies.

  1. The parking lot should have the ability to offer car wash and electric charging services to customers at the parking spot.
  2. The parking lot should support different parking strategies like nearest first or farthest first on the basis of floor number and id of the parking spot.

Please incorporate this requirement into your design by considering how the system will handle these additional services. For example, you could consider how customers will be able to request these services, how the system will track which cars need these services, and how payment for these services will be processed.

Low-Level Design Choices (Solution)

1. Class Structure

  • ParkingLot: Central class managing all floors, entrances, exits, and the global display board.
  • ParkingSpot: Abstract class with Mini, Compact, and Large spot subclasses. Each spot tracks occupancy and available services (car wash, electric charging).
  • Vehicle: Abstract class with Motorbike, Car, and Truck subclasses.
  • Entrance/Exit: Each has a unique ID and can be added or removed by the admin.
  • DisplayBoard: Shows real-time availability of spots by type.
  • ParkingTicket: Issued at entrance, tracks entry time, spot and vehicle.
  • ParkingEvent: Represents events related to parking activities, such as vehicle entry, exit.
  • Payment: Handles multiple payment methods and integrates with ticket and service charges.
  • ServiceRequest: Tracks additional services (car wash, charging) requested per spot.

2. Entrances and Exits

  • Entrances and exits are managed as objects, allowing dynamic addition/removal.
  • Each entrance is responsible for ticket generation and initial spot allocation.

3. Parking Spot Allocation

  • Supports multiple strategies (nearest first, farthest first).
  • Allocation considers both floor number and spot ID.

4. Display Board Updates

  • All display boards reflect real-time spot availability.
  • Updates triggered on vehicle entry/exit and service completion.

5. Ticket Generation and Payment

  • Tickets include vehicle info, assigned spot, entry time, and requested services.
  • Payment module supports cash, card, and digital wallets, and processes both parking and service fees.

6. Additional Services

  • Customers can request car wash or electric charging at entry.
  • Service requests are linked to the parking spot and tracked in the system.

7. Admin and Attendant Roles

  • Admin: Can add/remove entrances, exits, and manage floors and spots.
  • Attendant: Issues tickets, assists with spot allocation, and manages service requests.

Design Patterns Used

  • Singleton: For the ParkingLot class and DisplayBoard to ensure a single instance.
  • Strategy: For parking spot allocation strategies (nearest first, farthest first).
  • Observer: For updating display boards in real time on the bases of parking event.
  • Decorator: For adding additional service for the spot such as Car wash or electric charging as per the customer's requiremnts.

Additional Information

  • SOLID Principles: The design follows SOLID principles to ensure maintainability, scalability, and ease of extension.
  • Error Handling: The system validates spot availability, payment status, and service completion before exit.
  • Concurrency: Thread-safe operations for spot allocation and display updates.

About

Architected and implemented a scalable, low-level Parking Lot System leveraging SOLID principles and design patterns (Strategy, Singleton, Observer, Decorator) to ensure modularity, extensibility, and maintainability.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages