Design elevator simulation
- Identifying classes in a System
- ElevatorShaft, Elevator, Person, Floor, ElevatorDoor, FloorDoor, ElevatorButton, FloorButton, Bell, and Light
- UML Class Diagram
class name
|
class' attributes
|
class' operations
|
- Class associations using UML
- Solid line is an association, or relationship between classes
- Numbers near lines express multiplicity values which indicate how many objects of class participate in the association
- e.g. FloorButton has two-to-one relationship with ElevatorShaft
- Associations can be named.
- In the Class associations diagram, "Requests" indicates association and arrow indicates direction of association.
Thus one object of FloorButton requests one object of class Elevator.
- Aggregation relationship
- Implies whole/part relationship
- Some object "has" some object
- Object attached with diamond is "owner
- Object on other end is the "part"
- e.g. elevator shaft "has an" elevator and two floor buttons
- Class diagram for elevator model