Course 08
Course 08
Course 08
Software Engineering
State Transition Diagram
1
Definition
2
Example
3
State----------------Transition
State:
Describes a moment in the life of an instance. This instance can only
be in one state at a time.
Instances of the same class react to events in the same way.
Transition:
The response of an instance in a given state to an event.
Event: Triggers the transition.
Action: performing an operation when the transition is performed.
4
The State
5
The transition
6
Syntax of an event
• EVENT
it causes the crossing of the transition.
• GUARD-GUARD CONDITION: [] associate a condition with a transition. For the
transition to be crossed, the condition must be verified in addition to the
reception of the associated event, if it exists. It is a boolean expression (on the
attributes of the object or the parameters of the triggering event) which must be
true for the transition to be triggered ;
• EFFECT: ACTIVITY, a set of actions to be performed when triggered,
❑a primitive operation such as an instruction to assign a value to an attribute;
❑sending a signal;
❑calling an operation; etc.
❑when the action execution is completed, the target state of the transition
becomes active,
7
Example of a file
8
Types of events
1. Signal Event
2. Operation Call Event (Call Event ) (example openFile ())
3. Change Event
4.Time Event
9
temporal event
• events are generated by the flow of time.
• They are specified either absolutely (precise date),
• Absolutely ( triggered on a specific date)
• Syntax: when (date= “precise expression of a date”) ex: when (date=17/12/2010)
• • Relatively (triggered after a certain duration spent in the current state ).
• Syntax: after (“expression of a duration”) ex: after (10 seconds)
10
External/internal transition
11
Decision point
12
Distributor
13