OO State Transition Diagrams (PPT 18) Flashcards
What is a state?
A condition or situation in the life of an object during which it satisfies some condition, performs some activity or waits for some event
How can we find out a state of an object?
We can sometimes do this by looking at the value of an objects attributes
When can an object change state?
It can only change state when an event occurs
What are State Transitions?
They show movement from one state to another as a result of an event. Represented by direct lines between states, with the event that causes the change written as the name
What are the three types of event?
Call or signal event
-The receipt of a message from one object in the system
Change event
-A condition becomes true within the object
Time event
-An amount of time has elapsed
What is a State Transition Diagram?
A diagram that captures the lifecycle of an object
- States the object can assume
- Events/messages it can receive
- Response to events
How many state diagrams should you have?
In theory, one for each object but in reality, just model those with interesting states
What are some other state diagram notations?
Reflexive notation
-Transitions may lead to the same state they started in
Conditions
-Specify conditions under which transition will take place or not
Actions
-What an object does in response to an event, shown as part of the transition
Activities
-Show the activity which an object performs for the duration of a certain state
Initial/Final States
- Initial state shows starting point of life cycle (circle)
- Final state shows end of life cycle (Circle with circle around it)
What is the difference between Activities vs Actions?
Activities are ongoing while a state exists and can be interrupted by other events.