SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Downloaden Sie, um offline zu lesen
1
Session
State Diagram
Checklist
 Introduction to State diagram
 Explain State diagram notations
 Construct State diagram for our Case
Study
2
State Diagram
State Diagram also referred to as state chart diagram or state machine describes life of objects
in terms of events that change the state of the object. These events can be external or internal
events. State refers to the current condition of the object. Scope of the state is the entire life of
the object in a system. State diagram has been around for a long time around and is crucial in
embedded development.
Elements of a State Chart Diagram
Initial State
Figure 1: Initial state Notation
: Initial state is the starting point in a state chart
diagram. The circled dot will be followed by a
state always.
State : State encapsulates the object instance. States
are represented by a rounded rectangle.
Super & Sub state : State which holds other states and activities is
known as super state. States which goes inside
super state is known as sub state.
3
Figure 2: Super & Sub state
Final state
Figure 3: Final State Notation
: Final states denote deletion of an object. There
won’t be any triggers from the final state.
Event : Event is similar to triggers. They are responsible
for changing states in a system. These events
are denoted on the line connecting two states.
Syntax for writing events is trigger [guard –
condition]/action
Activity
Figure 4: Activity Notation
: States can not only listen to events and change
to other states, they can also have their own
internal functions. These internal functions are
denoted as activities.
Entry/Exit action
Entry action is performed when state is live &
Exit action is performed when live state moves
to the next state.
4
Split of Control : State Chart could handle the split of control by
using “Fork & Join”. A vertical line is used to
separate the flow of control as illustrated in the
figure.
Figure 5: Split of Control notation
Concurrency : When your system needs to perform two or
more actions simultaneously, they can also be
modeled in state chart diagram. Draw a dashed
line (----) to indicate concurrency as illustrated
in the figure.
5
Figure 6: Concurrency notation
History Pseudo state
Figure 7: Pseudo State
: Pseudo state can be better understood with an
example.
Consider you are hearing a song in you media
player and battery just died. When you restart
your media player, it will start playing from
where you left off.
To denote such occurrences pseudo state
(circled H) is used.
Constructing State Chart diagram for our Case study
Problem Statement
We are going to construct state diagram for an Alarm Clock. Functionalities of our alarm clock is
given below.
1. User can switch on or switch off the alarm clock
2. It can display time
3. Users can set alarm, delete alarm and can change alarm
4. There is no snooze button but user can stop the alarm when it goes of
6
Step 1: Get a view of the system. I have presented a wireframe for our alarm clock
Back
Alarm Icon
NewOk / Update
Alarm
Cancel / No
Update
StopAlarm time Delete / Ok
Figure 8: Alarm clock - Wireframe
7
Step 2: Identify the states used by the system
Based on the functionalities listed above, I could visualize followings states. We can add or
remove states anyways.
Figure 9: Step 2 - Alarm Clock States
Step 3: Look for activities, internal and external actions
Figure 10: Step 3 - Internal Activities & actions
I could come up with three states that have internal actions associated with them.
Display Current
Time
When our alarm clock is switched ON, it has to show current time. So
“Do” activity keeps incrementing time for our clock
Sound Alarm When users alarm time sets in, our clock should flash making sounds. To
monitor this “Blink Alarm” actions is placed under Do activity
Alarm List Menu When user presses alarm clock icon in the main screen, our clock has to
transition of list menu screen which shows the alarms previously set by
8
the user.
So whenever user enters this screen the list must be updated. Our
entry function is assigned to take care of this functionality.
Step 4: Assemble the parts and model the transition between states. Our final state chart
diagram looks like the figure below.
Figure 11: Alarm Clock - Timing Diagram
9
–
Review
 State chart diagram describes life of an object in terms of event
 State chart diagram is also known as state machine or state diagram
 Elements of state diagram – state, activity, pseudo state, event

Weitere ähnliche Inhalte

Was ist angesagt?

Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
Saurabh Kumar
 
System Models in Software Engineering SE7
System Models in Software Engineering SE7System Models in Software Engineering SE7
System Models in Software Engineering SE7
koolkampus
 
Silberschatz / OS Concepts
Silberschatz /  OS Concepts Silberschatz /  OS Concepts
Silberschatz / OS Concepts
Alanisca Alanis
 

Was ist angesagt? (20)

Oomd unit1
Oomd unit1Oomd unit1
Oomd unit1
 
States machine
States machineStates machine
States machine
 
Sequence diagram- UML diagram
Sequence diagram- UML diagramSequence diagram- UML diagram
Sequence diagram- UML diagram
 
Structure chart
Structure chartStructure chart
Structure chart
 
Activity Diagram
Activity DiagramActivity Diagram
Activity Diagram
 
Ooad unit – 1 introduction
Ooad unit – 1 introductionOoad unit – 1 introduction
Ooad unit – 1 introduction
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
UML
UMLUML
UML
 
Functional modeling
Functional modelingFunctional modeling
Functional modeling
 
Lecture6 activity diagrams
Lecture6 activity diagramsLecture6 activity diagrams
Lecture6 activity diagrams
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
OOAD UNIT I UML DIAGRAMS
OOAD UNIT I UML DIAGRAMSOOAD UNIT I UML DIAGRAMS
OOAD UNIT I UML DIAGRAMS
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram
 
System Models in Software Engineering SE7
System Models in Software Engineering SE7System Models in Software Engineering SE7
System Models in Software Engineering SE7
 
Object database standards, languages and design
Object database standards, languages and designObject database standards, languages and design
Object database standards, languages and design
 
Data Designs (Software Engg.)
Data Designs (Software Engg.)Data Designs (Software Engg.)
Data Designs (Software Engg.)
 
Silberschatz / OS Concepts
Silberschatz /  OS Concepts Silberschatz /  OS Concepts
Silberschatz / OS Concepts
 
Elaboration and domain model
Elaboration and domain modelElaboration and domain model
Elaboration and domain model
 
Behavioural modelling
Behavioural modellingBehavioural modelling
Behavioural modelling
 

Ähnlich wie State Diagram

Control Systems Lab 2
Control Systems Lab 2Control Systems Lab 2
Control Systems Lab 2
Julia London
 
Please show me how to do every part of this. Also could you show me .pdf
Please show me how to do every part of this. Also could you show me .pdfPlease show me how to do every part of this. Also could you show me .pdf
Please show me how to do every part of this. Also could you show me .pdf
support58
 
-10 Points- Description In this assignment you will translate a system.docx
-10 Points- Description In this assignment you will translate a system.docx-10 Points- Description In this assignment you will translate a system.docx
-10 Points- Description In this assignment you will translate a system.docx
janettjz6sfehrle
 

Ähnlich wie State Diagram (20)

Interaction overview & Timing diagram
Interaction overview & Timing diagramInteraction overview & Timing diagram
Interaction overview & Timing diagram
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
 
Generation of state diagram from time chart
Generation of state diagram from time chartGeneration of state diagram from time chart
Generation of state diagram from time chart
 
State-Machine-Diagram.pptx
State-Machine-Diagram.pptxState-Machine-Diagram.pptx
State-Machine-Diagram.pptx
 
Component Diagram
Component DiagramComponent Diagram
Component Diagram
 
Control systems and Robotics
Control systems and RoboticsControl systems and Robotics
Control systems and Robotics
 
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)
 
Chapter7
Chapter7Chapter7
Chapter7
 
PLC: Capitulo 11 uso de diagramas de estado
PLC: Capitulo 11 uso de diagramas de estadoPLC: Capitulo 11 uso de diagramas de estado
PLC: Capitulo 11 uso de diagramas de estado
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptx
 
UML.pptx
UML.pptxUML.pptx
UML.pptx
 
Unit three Advanced State Modelling
Unit three Advanced State ModellingUnit three Advanced State Modelling
Unit three Advanced State Modelling
 
Introduction to Control System Design
Introduction to Control System DesignIntroduction to Control System Design
Introduction to Control System Design
 
Jetpack Compose untuk UI Masa Depan Bagian 2 - Sidiq Permana
Jetpack Compose untuk UI Masa Depan Bagian 2 - Sidiq PermanaJetpack Compose untuk UI Masa Depan Bagian 2 - Sidiq Permana
Jetpack Compose untuk UI Masa Depan Bagian 2 - Sidiq Permana
 
08 state diagram and activity diagram
08 state diagram and activity diagram08 state diagram and activity diagram
08 state diagram and activity diagram
 
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction DiagramsSE18_Lec 10_ UML Behaviour and Interaction Diagrams
SE18_Lec 10_ UML Behaviour and Interaction Diagrams
 
Control Systems Lab 2
Control Systems Lab 2Control Systems Lab 2
Control Systems Lab 2
 
Please show me how to do every part of this. Also could you show me .pdf
Please show me how to do every part of this. Also could you show me .pdfPlease show me how to do every part of this. Also could you show me .pdf
Please show me how to do every part of this. Also could you show me .pdf
 
-10 Points- Description In this assignment you will translate a system.docx
-10 Points- Description In this assignment you will translate a system.docx-10 Points- Description In this assignment you will translate a system.docx
-10 Points- Description In this assignment you will translate a system.docx
 

Mehr von University of Texas at Dallas

Mehr von University of Texas at Dallas (13)

Communication Diagram
Communication DiagramCommunication Diagram
Communication Diagram
 
Sequence Diagram
Sequence DiagramSequence Diagram
Sequence Diagram
 
Package Diagram
Package DiagramPackage Diagram
Package Diagram
 
Deployment Diagram
Deployment DiagramDeployment Diagram
Deployment Diagram
 
Composite Structure Diagram
Composite Structure DiagramComposite Structure Diagram
Composite Structure Diagram
 
Object diagram
Object diagramObject diagram
Object diagram
 
Class diagram
Class diagramClass diagram
Class diagram
 
Use Case UML Diagram
Use Case UML DiagramUse Case UML Diagram
Use Case UML Diagram
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
Libraries
LibrariesLibraries
Libraries
 
Yocto project
Yocto projectYocto project
Yocto project
 
Subversion Reference
Subversion ReferenceSubversion Reference
Subversion Reference
 
Subversion
SubversionSubversion
Subversion
 

Kürzlich hochgeladen

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Kürzlich hochgeladen (20)

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 

State Diagram

  • 1. 1 Session State Diagram Checklist  Introduction to State diagram  Explain State diagram notations  Construct State diagram for our Case Study
  • 2. 2 State Diagram State Diagram also referred to as state chart diagram or state machine describes life of objects in terms of events that change the state of the object. These events can be external or internal events. State refers to the current condition of the object. Scope of the state is the entire life of the object in a system. State diagram has been around for a long time around and is crucial in embedded development. Elements of a State Chart Diagram Initial State Figure 1: Initial state Notation : Initial state is the starting point in a state chart diagram. The circled dot will be followed by a state always. State : State encapsulates the object instance. States are represented by a rounded rectangle. Super & Sub state : State which holds other states and activities is known as super state. States which goes inside super state is known as sub state.
  • 3. 3 Figure 2: Super & Sub state Final state Figure 3: Final State Notation : Final states denote deletion of an object. There won’t be any triggers from the final state. Event : Event is similar to triggers. They are responsible for changing states in a system. These events are denoted on the line connecting two states. Syntax for writing events is trigger [guard – condition]/action Activity Figure 4: Activity Notation : States can not only listen to events and change to other states, they can also have their own internal functions. These internal functions are denoted as activities. Entry/Exit action Entry action is performed when state is live & Exit action is performed when live state moves to the next state.
  • 4. 4 Split of Control : State Chart could handle the split of control by using “Fork & Join”. A vertical line is used to separate the flow of control as illustrated in the figure. Figure 5: Split of Control notation Concurrency : When your system needs to perform two or more actions simultaneously, they can also be modeled in state chart diagram. Draw a dashed line (----) to indicate concurrency as illustrated in the figure.
  • 5. 5 Figure 6: Concurrency notation History Pseudo state Figure 7: Pseudo State : Pseudo state can be better understood with an example. Consider you are hearing a song in you media player and battery just died. When you restart your media player, it will start playing from where you left off. To denote such occurrences pseudo state (circled H) is used. Constructing State Chart diagram for our Case study Problem Statement We are going to construct state diagram for an Alarm Clock. Functionalities of our alarm clock is given below. 1. User can switch on or switch off the alarm clock 2. It can display time 3. Users can set alarm, delete alarm and can change alarm 4. There is no snooze button but user can stop the alarm when it goes of
  • 6. 6 Step 1: Get a view of the system. I have presented a wireframe for our alarm clock Back Alarm Icon NewOk / Update Alarm Cancel / No Update StopAlarm time Delete / Ok Figure 8: Alarm clock - Wireframe
  • 7. 7 Step 2: Identify the states used by the system Based on the functionalities listed above, I could visualize followings states. We can add or remove states anyways. Figure 9: Step 2 - Alarm Clock States Step 3: Look for activities, internal and external actions Figure 10: Step 3 - Internal Activities & actions I could come up with three states that have internal actions associated with them. Display Current Time When our alarm clock is switched ON, it has to show current time. So “Do” activity keeps incrementing time for our clock Sound Alarm When users alarm time sets in, our clock should flash making sounds. To monitor this “Blink Alarm” actions is placed under Do activity Alarm List Menu When user presses alarm clock icon in the main screen, our clock has to transition of list menu screen which shows the alarms previously set by
  • 8. 8 the user. So whenever user enters this screen the list must be updated. Our entry function is assigned to take care of this functionality. Step 4: Assemble the parts and model the transition between states. Our final state chart diagram looks like the figure below. Figure 11: Alarm Clock - Timing Diagram
  • 9. 9 – Review  State chart diagram describes life of an object in terms of event  State chart diagram is also known as state machine or state diagram  Elements of state diagram – state, activity, pseudo state, event