ICS 121: UML Elevators Example
Overview
- Elevators example
- Elevators use cases
- Elevators class diagram
- Elevators state charts
Elevators example
- Background and motivation:
- Soon UCI will have buildings on all available land.
- UCI will need taller buildings to continue to grow
- Those buildings will need banks of elevators
- Desired functionality:
- Elevators safely carry users from one floor to another
- When idle, elevators automatically move to a default floor
- Elevators can be passenger elevators or freight elevators
Elevators use case: Quickly using idle elevator
- User enters elevator on ground floor
- User presses floor 8 button
- Doors close
- Elevator moves up to desired floor
- Doors open
- User leaves
- Note: Elevator was waiting on ground floor because it had been idle
Elevators use case: Hold the door
- User1 enters elevator on ground floor
- User1 presses floor 8 button
- Doors start to close
- User1 sees User2 approaching
- User1 presses "open door" button
- Doors open fully
- User2 enters and sees floor 8 button already lit
- Doors close after 10 seconds
- Elevator moves up to desired floor
- Doors open
- User leaves
- Note: User2 does not need to press anything
- Note: User1 or User2 could have pressed detector on inside edge of door
Elevators use case: Sharing a ride
- User1 enters elevator on ground floor
- User1 presses floor 8 button
- Doors close
- Elevator moves up to floor 3
- Doors open
- User2 enters and presses floor 6
- Doors close
- Elevator moves up to floor 6
- Doors open
- User2 leaves
- Doors close
- Elevator moves up to floor 8
- User1 leaves
- Doors close
What to notice about elevators use cases
- Use cases are just example of usage, not complete specifications of every possible situation
- Use cases show an actor succeeding at a goal
- Use cases just describe what the actor sees and does, not what happens internally to the system
- Don't try to "program" in use cases, add extension points for unusual situations, or split the
use case
- Goal of uses cases is to help explore requirements and prompt feedback from stakeholders
- Use case can be evaluated for usability: number of steps, difficult steps
Elevator class diagram
What to notice about elevators class diagram
- Classes define types of instances and possible relations
- Classes are homomorphic to types of real-world objects, when possible
- Classes contain same attributes and operations as real-world objects, when possible
- Generalizations used for subclasses
- Attributes show variables in each instance of a class
- Associations show possible relations between instances of classes
- Label associations with the meaning of the relationship, if not otherwise clear
- Multiplicities limit the number of instances in an association
- Black diamond on whole where parts share the same life-time (like fingers)
- White diamond on whole where parts can be added or removed, or are not exclusive (like rings)
- Diamond-side of black-diamond association always has multiplicity 1
Elevator state diagram
What to notice about elevators state diagram
- Shows possible states of instances of just one class
- Dashed line divides concurrent state machines
- Transitions between states have English descriptions or "event [guard] / action"
- States may have actions on "entry", "do", "exit", or internal transitions
- Guard conditions may refer to attribute values
example use case templatesample test plan templateProject plan template