Design a Shipping Locker System
MediumReal World SystemsStrategyObserverSingleton
Problem Statement
Design an Amazon Locker-style shipping locker system that:
- Manages package delivery and pickup at locker stations
- Assigns packages to appropriately-sized lockers
- Sends access codes to recipients
- Handles package expiration (unclaimed packages)
- Manages multiple locker stations
Design Requirements
Key Entities:
LockerStation— A physical location with multiple lockersLocker— Individual locker with size and statusPackage— Has dimensions, weight, recipientDelivery— Assignment of package to lockerAccessCode— Time-limited code sent to recipientNotificationService— Sends email/SMS notifications
Key Behaviors:
assignLocker(package)→ finds nearest available locker, generates access codepickupPackage(accessCode)→ validates code, opens locker, marks as collectedexpireOldPackages()→ returns unclaimed packages after 3 days
!Constraints
- Locker sizes: Small (< 1kg, < 30cm), Medium (< 5kg, < 60cm), Large (< 25kg, < 120cm)
- Access code is 6-digit numeric, expires in 72 hours
- Package must be picked up within 3 days or is returned to sender
- One package per locker at a time
- Locker station has 5–50 lockers of mixed sizes
Output
Run your code to see output here.