State Chart Diagram-Sem-III
State Chart Diagram-Sem-III
9.0 Objective
9.1 Introduction
9.2 State Diagram
9.3 State Diagram Uses
9.4 Why State Machine Diagram
9.5 Diagram Model Elements in State chart Diagrams
9.6 Difference between State Diagram and Flowchart
9.7 To Draw a State chart Diagram
9.8 Example of State chart Diagram.
9.9 Summary
9.10 Check your Progress – Answers
9.11 Questions for Self – Study
9.12 Suggested Readings
9.0 OBJECTIVE
UML diagrams that depict behaviour are called state diagrams. It demonstrates a dynamic or
behavioural aspect of a system. "Dynamic aspect" describes how a state diagram shows the state
of a system at a particular moment in time.
9.2 State Diagram
Every behavioural state that a software system component is capable of showing, as well
as every state transition that the component is expected to encounter while functioning, are
represented in a state diagram, also known as a state machine or a statechart diagram.
A state diagram shows a system's or a system component's status at a given point in time. It's a
behavioural diagram that illustrates the behaviour with finite state transitions. State machines and
state-chart diagrams are other names for state diagrams. To put it simply, a state diagram shows
how a class will function dynamically both across time and in response to shifting external
stimuli. Although we can say that all classes have states, not all classes have state diagrams used
to represent them.
2. To model the system of reactive items that makes up the reactive system.
a. Initial State: The first or the default state the object is in. It is denoted by a solid circle.
b. State: All the states an object can go in are mentioned in this. It is represented by a
rectangle with rounded edges.
STATE
STATE1 STATE2
Events
d. Final State: Depicts the end of the State. It is shown by a bull's eye symbol.
Figure 9.4 – Final State
e. Decision box- The decision box represents the decisions that will be made based on an
evaluated guard. A diamond shape represents it.
Decisio
n
f. Fork- A fork represents a state splitting into two or more concurrent states. It is
represented by a rounded rectangular solid bar with arrows incoming from the parent
state and towards the concurrent states.
State A
State B State C
State B State C
State A
The state machine diagram is used to show the several states that an object can go through. A
transition from one state to another is brought about by an event. It is necessary to identify every
possible state for a certain component before drawing a state machine diagram.
The primary goal of a state machine diagram is to depict the states of a system. These states are
required for drawing a state transition diagram. It is essential to identify the entities, conditions,
and occurrences that lead to a state transition before putting a state machine diagram into
practise.
The steps that must be included while creating a state machine diagram are as follows:
1. A distinct and intelligible term that characterises the system's behaviour ought to be given
to the state transition.
2. Only the most important of the several objects are put into practise.
3. The transitions and events need to be given appropriate names.
9.8 Example of State Chart Diagram.
This state diagram shows the process of enrollment and classes at a university. The composite
state “Enrollment” is made up of various substates that will lead students through the enrollment
process. Once the student has enrolled, they will proceed to “Being taught” and finally to “Final
exams.”
9.9 SUMMARY
The transfer of control from one state to another is depicted in a state chart diagram.
States are described as a situation in which an object existing and undergoes a change in
response to an event. The main goal of a state chart diagram is to model an object's lifetime
from creation to destruction.
9.10 CHECK YOUR PROGRESS – ANSWERS
9.1 – 9.6
1. Transitions
2. Final State
3. Dynamic
9.6 -9.8
1. Fork
2. Join
3. Flowchart
***