Requirements
Functional Requirements:
- Assign parking spots based on vehicle size, allowing motorcycles to park in small spots, cars in medium spots, and trucks in large spots, with the option to park in larger spots if needed.
- Issue a ParkingTicket upon vehicle entry, which records the vehicle information, assigned parking spot, and entry timestamp.
- Compute the parking fee upon vehicle exit based on the duration of stay and a configurable pricing strategy.
- Handle scenarios where the parking lot is full by rejecting entry and displaying a lot-full indicator to the driver.
- Support multiple floors in the parking lot, with each floor containing a mix of small, medium, and large parking spots.
Non-Functional Requirements:
- List the key non-functional requirements (eg thread safety, extensibility, maintainability, etc.)...
- Ensure thread safety and concurrency control to prevent race conditions during parking spot allocation and ticket processing.
- Ensure high performance with efficient data structures for fast lookup of available spots and ticket validation.
- Ensure scalability to support multiple floors and increasing number of vehicles without performance degradation.
- Ensure maintainability by following SOLID principles and clean architecture.
- Ensure extensibility to allow adding new parking spot types, pricing strategies, and floors without modifying existing code.
- Ensure loose coupling by programming to interfaces rather than concrete implementations.
- Ensure data consistency and integrity using transactional (ACID-compliant) operations.
- Ensure configurability so pricing rules and system parameters can be changed without code modification.
- Ensure reliability and availability so the system remains operational under load.
- Ensure data validation and security to prevent invalid ticket usage and unauthorized access.
- Ensure testability to support unit and integration testing of components.
Core Objects & Relationships
Based on the requirements and use cases, identify the main objects of the system and analyze how they interact and relate to each other...
My objects are
Parkinglots: It will be the first place where cars will wait and request for a parking spot o a specific parking floor.
ParkingFloor: Will assign A spot on the free spot of that specific floor.
Parking Spot : Will assign a spot according to the size of the vehicle. Also check for a Full by rejecting entry.
Parking Ticket: Will assign a ticket based on entry time and exit time.
Vehicle: Represents vehicles entering the system (motorcycle, car, truck).
PricingStrategy: Responsible for calculating parking fees based on duration.
APIs & Class Members
For each class, define the attributes (data) it will hold and the methods (functions) that operate on the attributes. Ensure they align with the object's responsibilities and adhere to the principle of encapsulation. Write your code in the code editor below.
Deep Dive
Explain design tradeoffs you considered. Check and explain whether your design adheres to SOLID principles. Explain how your design can handle changes in scale and whether it would be easy to extend with new functionalities. Identify areas for future improvement...