guide to state transition diagram. 2 contents what is state transition diagram? when is state...

13
Guide to State Transition Diagram

Upload: stuart-hensley

Post on 31-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

Guide toState Transition Diagram

2

Contents

What is state transition diagram?

When is state transition diagram used?

What are state transition diagram notations?

How to perform state transition diagram?

A sample of state transition diagram– sample 1

A sample of state transition diagram– sample 2

A sample of state transition diagram– sample 3

A sample of state transition diagram– sample 4

3

What is state transition diagram?A state diagram (STD) is a type of diagram used in computer science and related fields to describe the behavior of systems. State diagrams require that the system described is composed of a finite number of states; sometimes, this is indeed the case, while at other times this is a reasonable abstraction. Many forms of state diagrams exist, which differ slightly and have different  semantics.

State diagrams are used to give an abstract description of the behavior  of a system. This behavior is analyzed and represented in series of events, that could occur in one or more possible states. Hereby "each diagram usually represents objects of a single class and track the different states of its objects through the system“.

4

When is state transition diagram used?

State transition diagrams allow the user to model how a system reacts to (and generates) events over time. State transition diagrams are often used when modeling real-time systems but can be generally applied to any object which has several states of operation that depend upon both internal and external activity. Each of the states and the transitions between the states are diagrammatically shown along with events, conditions and actions that are associated with the transitions from one state to another.

5

What are state transition diagram notations?Initial StateDefinition: An initial state is used to identify the first transition to be taken within a model. The destination of the first transition is thus the first state to be entered within the model (i.e. the default state).Representation: An initial state is represented by a solid circular shaped node that is (by default) black in color. i.e.  Creation: The initial state is created automatically when the model is first created.Rules: There can be only one initial state of a system and it cannot be deleted as all state transition diagrams must have an initial state. An initial state may have several outgoing transitions, but in this case each transition should be in response to a different incoming event (or guard condition). An initial state may have no incoming transitions.

6

What are state transition diagram notations?

Final StateDefinition: A final state is used to identify the completion of a state machine. A final state has incoming transitions only.Representation: A final state is represented by a solid circular shaped node with a larger outer circle that is (by default) black in color. i.e. Rules: There can be at most one final state of a system. A final state may have several incoming transitions but may not have any outgoing transitions.

7

What are state transition diagram notations?

StateDefinition: A state is used to represent a situation or condition where a set of circumstances are known to be true. States are connected to other states using transitions which define why a state is entered and why a state is exited.Representation: A state is represented by a rectangular node shape with rounded corners. By default the state is yellow with a black border. i.e. Rules: A state must have at least one incoming and one outgoing transition. A state must be named.

8

What are state transition diagram notations?

TransitionsDefinition:  A transition is used to model the changing of state within a system. A transition is triggered by a specific event. Once the transition has been taken a specified action may be executed. An optional guard may also be shown (usually by placing a [condition] after the trigger event name) that identifies additional constraints that must be satisfied before the transition may be taken.Representation:  A transition is represented by solid line linking a source and destination state. An arrow indicates the direction of the transition. The event and possible action are shown next to a transition separated by a horizontal line. i.e. 

Rules:  A transition should always have an event specified (except to the final state), but actions are optional.

9

How to perform state transition diagram?

• Identify observable states of the system;

• Select the states with normal behavior;

• Specify the conditions that mark a transition;

• Specify the actions to produce the observable behavior in the destination state for each transition;

• If the system is complex, partition the diagram in several STD's.

10

A sample of state transition diagram- sample 1

A bank account example

11

A sample of state transition diagram- sample 2

An email example

12

A sample of state transition diagram- sample 3

A sale order example

13

A sample of state transition diagram- sample 4

A hotel reservation

example