Lecture 7
What are State Transition Diagrams?
1. Definition
o State Transition Diagrams (STDs) are UML diagrams that
describe the various states an object can be in, as well as the
transitions between these states. They are a type of behavioural
diagram that can also be called:
State Diagrams
Statechart Diagrams
State Machine Diagrams
2. Purpose
o STDs are used to model the behaviour of a system by showing how
an object transitions from one state to another in response to
events. They can represent the lifespan of a class from creation to
destruction.
Basic UML State Diagram Notation
1. Components
o States: Represented by rounded rectangles, indicating the status of
an object at a specific point in time.
o Transitions: Arrows that indicate the movement from one state to
another, triggered by events.
o Events: External occurrences that cause transitions between
states.
o Actions: Behaviours executed during a transition.
2. Events and Guards
o Event: An occurrence that triggers a state change (e.g., a button
press).
o Guard: A Boolean condition that must be true for the transition to
occur.
o Action: A specific behaviour that occurs as a result of the
transition.