Sequence Diagram for the Elevator System
Visualize the sequence diagram for calling the elevator, and solve a challenge.
We'll cover the following
A sequence diagram is a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for our elevator system. In this lesson, we will create sequence diagrams for the following two interactions:
Elevator call: The passenger calls the elevator.
Sequence challenge: The passenger rides the elevator to a floor.
Elevator call
The sequence diagram for an elevator call should have the following actors and objects that will interact with each other:
Actor:
Passenger
Objects:
HallButton
,ElevatorSystem
,Dispatcher
,ElevatorCar
, andDoor
Here are the steps in the elevator call interaction:
The passenger presses the hall button to call the elevator.
The hall button signals the elevator system to call an elevator car to the passenger's floor.
The elevator system informs the dispatcher to select the best car.
The dispatcher returns the best car to the system.
The elevator system signals the elevator car to move to the passenger's floor.
The elevator car signals the system when it arrives on the floor.
The system signals the hall button that the elevator has arrived.
The hall button is unpressed.
The elevator system signals the doors to open.
The door opens for the passenger.
Based on the order above, the sequence diagram for an elevator call in the elevator system is given below.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.