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.)...
- Thread Safety :- The system must ensure strong consistence and linearizability during spot allocation process. We must use the distributed locks or optimistic concurrency control to prevent "double parking" (assigning the same spot to two vehicles) under high request volumes.
- Extensibility:- The system should follow the Open-closed principle. it must be designed to support new vehicle type (Ex:- electric vehicle with charging needs) or new payment modes with (ex:- Crypto, NFC) without modifying the core parking logic"
- Maintainability:- The system should aim for High Availability (99.9%). Even if the fee calculation service is down, the entry gates should function (fail-open/ fail-soft) to avoid traffic congestion. Additionally, the code should follow SOLID principles to ensure a low mean time to repair.
- Scalability:- The system should handle a single small lot or a massive multi story complex with thousands of spots across different geographical locations.
- Low Latency:- Entry and exit processing (gate opening) should happen in under 200ms to prevent vehicle queuing at physical entrances.
- Reliability / Durability :- Parking transaction logs and ticket data must be persisted in db with ACID compliance to ensure no loss of revenue data.
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...
User{
id,
name,
email id,
phoneNo,
List
}
Vehicle{
id,
vehicleId,
vehicleName,
vehicleType,
userId,
}
Parking{
id,
parkingPlaceNo,
parkingPlaceType,
parkingStartTime,
parkingEndTime,
parkedVehicle,
}
ParkingPricing{
id,
transactionId,
parkingPlaceNo,
parkingPrice,
transactionType
}
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...