Non-functional requirements:
The building allows defining elevator locations. Each location defines a set of available floors and restrictions (working hours, max weight, etc).
The elevator can be requested and drop at all available floors. If the request or drop operation requires privileged access, the specific token should be provided that is verified with SecurityTokenVerifier.
The movement plan for the elevator is encapsulated in the ElevatorPlan instance that defines an order of floors to go through.
The elevator plan is enforced by the corresponding ElevatorScheduler. All requests to request, drop or reschedule elevator go through the scheduler.
If elevator's movement plan depends on other elevators, they can be merged into the cluster. So, each time the elevator's position is updated, plans for linked locations can be updated as well.
The operation mode can change. Effectively, the operation mode just changes the underlying scheduler and reschedules all elevators.
The plan is reconsidered each time when the request/drop is made.
Also the system has a monitoring system that periodically validates the elevator state and allows setting up alerts to be notified about the suspicious behavior.
Generally, the data model prefers to use composition over inheritance
ElevatorScheduler, SecurityTokenVerifier, ElevatorObserver implement strategy pattern. LocationBuilder implements a builder pattern.
Also we use an observer pattern to notify the model about updates from the device.
Attributes: For each class, define the attributes (data) it will hold...
Methods: Define the methods (functions) that operate on the attributes. Ensure they align with the object's responsibilities and adhere to the principle of encapsulation.
public class Car { ... } // ExampleSRP
OCP:
LSP:
ISP:
DIP:
The system can be extended with custom ElevatorSchedulers
Try creating a class, flow, state and/or sequence diagram using the diagramming tool. Mermaid flow diagrams can be used to represent system use cases. You can ask the interviewer bot to create a starter diagram if unfamiliar with the tool. Briefly explain your diagrams if necessary...