Course Content
Data Structures & Algorithms
Full Stack Web Development
Understanding and playing with DOM (Document Object Model)
0/2
MERN project
0/2
Low Level System Design
LLD Topics
High Level System Design
Fast-Track to Full Spectrum Software Engineering
Class Diagram – Elevator System

class diagram models the static structure of the system by showing classes, attributes, methods, and relationships between them. The Elevator System is a good example to demonstrate real-world object orientation including inheritance, composition, and associations.



Key Classes & Their Relationships


1. ElevatorSystem

Attributes:

  • elevators: List<Elevator>
  • controller: ElevatorController

 

Methods:

  • requestElevator(floor: int, direction: Direction)
  • step() // Advances system by one time unit

 

Relationships:

  • Aggregates multiple Elevator objects.
  • Delegates control logic to ElevatorController.


2. Elevator

Attributes:

  • currentFloor: int
  • direction: Direction (enum: UP, DOWN, IDLE)
  • state: ElevatorState (enum: MOVING, STOPPED, DOOR_OPEN)
  • floorQueue: Queue<int>

 

Methods:

  • move()
  • openDoor()
  • closeDoor()
  • addFloorRequest(floor: int)

 

Relationships:

  • Composed inside ElevatorSystem.
  • Communicates with Door and ButtonPanel.

3. ElevatorController

Attributes:

  • elevators: List<Elevator>

 

Methods:

  • assignElevator(floor: int, direction: Direction)
  • optimizeRequests()

 

Responsibilities:

  • Central logic that assigns which elevator should serve a floor request.


4. Floor

Attributes:

  • floorNumber: int
  • upButton: Button
  • downButton: Button

 

Methods:

  • pressUp()
  • pressDown()

 

Relationships:

  • Aggregated by ElevatorSystem.


5. Door

Attributes:

  • isOpen: boolean

 

Methods:

  • open()
  • close()

 

Relationships:

  • Composed by Elevator.


6. ButtonPanel

Attributes:

  • buttons: Map<int, Button> // floor number to Button

 

Methods:

  • pressButton(floor: int)

 

Relationships:

  • Composed by Elevator.


7. Button

Attributes:

  • isPressed: boolean

 

Methods:

  • press()
  • reset()


8. EmergencySystem

Attributes:

  • isAlarmActive: boolean

 

Methods:

  • triggerAlarm()
  • stopAlarm()

 

Relationships:

  • May be linked to Elevator or ElevatorSystem depending on design.


Optional Classes for Extensions:

  • WeightSensor (to detect overload).
  • MaintenanceMode (for technicians).
  • AccessControl (for security-restricted floors).


Design Highlights for Students:

  • Demonstrates composition (e.g., Elevator has Door, ButtonPanel).
  • Shows aggregation (e.g., ElevatorSystem has multiple Elevators).
  • Can explain state transitions using state and direction enums.
  • Opens discussion on real-world modeling of asynchronous systems.
0% Complete
WhatsApp Icon

Hi Instagram Fam!
Get a FREE Cheat Sheet on System Design.

Hi LinkedIn Fam!
Get a FREE Cheat Sheet on System Design

Loved Our YouTube Videos? Get a FREE Cheat Sheet on System Design.