SlideShare a Scribd company logo
1 of 24
Download to read offline
Topics - State Modeling
• Events
• States
• Transitions and
• Conditions
• State Diagrams
1
Introduction
• Changes to the objects and their relationships over
time.
• Those aspects of a system with time and changes are
called state model.
• Control is the aspect of the system that describes the
sequences of operations that occur in response to
external stimuli
2
Introduction
• The major state modeling concepts are:
– Events :- represent external stimuli
– States :- represent values of objects
– State diagrams :- graphical representation of finite
state machine
3
1.Events
• An event is an occurrence at a point in time.
• One event may logically precede or follow another, or
the two events may be unrelated.
• Two events that are causally unrelated or related
• Causally unrelated event is said to be concurrent;
they have no effect on each other. Concurrent events
can occur in any order.
 Two events are causally related. E.g. Flight 123 must
depart Chicago after it can arrive in San Francisco.
The two events are causally unrelated. E.g. Flight 123
may depart before or after Flight 456 departs Rome.
4
1.Events contd.
• An event is a one way transmission of information
from one object to another.
• Events include error conditions as well as normal
occurrences.
• Eg :-transaction aborted , time out
• Note : often appear past tense verb (ex: power
turned on) or on set condition (temperature
becomes lower than freezing)
5
Kinds of Events
There are several kinds of events, the most common are
– Signal event
– Change event
– Time event
6
Signal Event
• A signal is an explicit one-way transmission of
information from one object to another
• A signal event is the event of sending or receiving a
signal.
• Event is not like a subroutine call that returns a value
– An object sending an event to another may expect a reply, but
the reply is a separate event under the control of the second
object, which may or may not choose to send it.
– Note: A signal is a message between objects but a signal event
is an occurrence in time
7
Signal Class and Attributes
8
Change Events
• A change is an event that is caused by the satisfaction
of a Boolean expression.
• The uses of change event is tested continuously:
whenever the expression changes from false to true
• The UML notation : when keyword followed by a
parenthesized Boolean expression
• Example of change events
– When (room temperature < heating set point)
– When (room temperature > cooling set point)
9
Time Events
• A time event is an event caused by the occurrence of
an absolute time or the elapse of a time interval.
• The UML notation : The notation for a time interval is
the keyword when / after followed by a parenthesized
expression
• Example of time events
– When (date= January 1, 2014)
– After (10 seconds)
10
2.States
• It is often associated with a continuous activity. Ex.
Telephone ringing
• A STATE is an abstraction of the attribute values and
links of an object
• It has duration (occupies an interval of time)
• A state is drawn as a rounded box containing an
optional name
11
State - Examples
Waiting Dialing Powered
Power turned on Power turned off Power turned on
Powered Not Powered
time
Difference between states and events
13
States
1. Represent values of
object
2. The attribute values
and links held by an
object
3. A state has duration.
it occupies an interval
of time
4. State separates two
events
Events
1. Represent external
stimuli
2. An individual stimulus
from one object to
another
3. An event has no
duration. It happens
at a point of time
4. An event separates
two states
13
3.Transitions
• A change of state caused by an event is called
transitions.
• It is an instantaneous change from one state to another.
• The source and target of a transition are different states
or same state.
• The choice of next state depends on both the original state
and the event received.
• The UML notation for a transition is a line with
arrowhead from the source state to the target state
• Example of transition:
– When a called phone is answered, the phone line
transitions from the Ringing state to the Connected state.
14
4.Conditions
• A guard condition is a Boolean expression that must be
true in order for a transition to occur.
• A state can be defined in terms of a condition that valid
over interval of time
• Conditions can be used as guards on transitions
• A guards transitions fires when its event occurs , but only
if the guard condition is true
• a guard condition is checked only once
• A condition is listed within square brackets [] after an
event name
• For example
– a person goes out in the morning (event),
– if the temperature is below freezing (condition) , then put
on your gloves(next state).
15
5.State Diagrams
• A state diagram is a graph whose nodes are states
and whose directed arcs are transitions labeled by an
event names
• A state diagram specifies the state sequences caused
by event sequences.
• State names must be unique within the scope of a
state diagram
• Note: state diagrams can implement by direct
implementation or by converting into programming
code
16
5.State Diagrams
• The state model consists of multiple state
diagrams, one state diagram for each class with
important temporal behavior
• State diagram contains sequences associated
with normal call as well as abnormal call ( time
out while dialing , getting busy line)
• States can represent
– continuous loops
– one shot life cycles
17
State diagram( continuous loop) for phone line
18
One-shot life cycles
• It represents objects with finite lives
• It has initial and final states
• The initial state is entered on creation of an object
• An initial state is shown by a solid circle
• The circle can be labeled to indicate different initial
conditions
• Final state implies destruction of the object
• The final state shown by a bull’s eye. It distinguished
from initial state
19
State diagram(One-shot life cycles) for chess game
20
Summary of Basic State Diagram Notation
• The following Figure summarizes the basic UML
syntax for state diagrams.
21
State diagram name
State1
do / activity
event / effect
State2
…..
event (attribs)
[condition]/effect
21
22
23
24

More Related Content

Similar to State Diagram.pdf

T305 tutorial 4
T305 tutorial 4T305 tutorial 4
T305 tutorial 4
hoooma
 

Similar to State Diagram.pdf (20)

State diagram
State diagramState diagram
State diagram
 
State diagram
State diagramState diagram
State diagram
 
State diagram
State diagramState diagram
State diagram
 
States machine
States machineStates machine
States machine
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptx
 
Ooad 3
Ooad 3Ooad 3
Ooad 3
 
Software engineering.pptx
Software engineering.pptxSoftware engineering.pptx
Software engineering.pptx
 
Software engineering.pptx
Software engineering.pptxSoftware engineering.pptx
Software engineering.pptx
 
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
 
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
 
Ooad ch 5
Ooad ch 5Ooad ch 5
Ooad ch 5
 
Seminar State Chart1
Seminar State Chart1Seminar State Chart1
Seminar State Chart1
 
08 state diagram and activity diagram
08 state diagram and activity diagram08 state diagram and activity diagram
08 state diagram and activity diagram
 
Jar chapter 4, part 1
Jar chapter 4, part 1Jar chapter 4, part 1
Jar chapter 4, part 1
 
Programming models for event controlled programs
Programming models for event controlled programsProgramming models for event controlled programs
Programming models for event controlled programs
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
 
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)
 
T305 tutorial 4
T305 tutorial 4T305 tutorial 4
T305 tutorial 4
 
Sequence diagrams
Sequence diagramsSequence diagrams
Sequence diagrams
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Recently uploaded (20)

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

State Diagram.pdf

  • 1. Topics - State Modeling • Events • States • Transitions and • Conditions • State Diagrams 1
  • 2. Introduction • Changes to the objects and their relationships over time. • Those aspects of a system with time and changes are called state model. • Control is the aspect of the system that describes the sequences of operations that occur in response to external stimuli 2
  • 3. Introduction • The major state modeling concepts are: – Events :- represent external stimuli – States :- represent values of objects – State diagrams :- graphical representation of finite state machine 3
  • 4. 1.Events • An event is an occurrence at a point in time. • One event may logically precede or follow another, or the two events may be unrelated. • Two events that are causally unrelated or related • Causally unrelated event is said to be concurrent; they have no effect on each other. Concurrent events can occur in any order.  Two events are causally related. E.g. Flight 123 must depart Chicago after it can arrive in San Francisco. The two events are causally unrelated. E.g. Flight 123 may depart before or after Flight 456 departs Rome. 4
  • 5. 1.Events contd. • An event is a one way transmission of information from one object to another. • Events include error conditions as well as normal occurrences. • Eg :-transaction aborted , time out • Note : often appear past tense verb (ex: power turned on) or on set condition (temperature becomes lower than freezing) 5
  • 6. Kinds of Events There are several kinds of events, the most common are – Signal event – Change event – Time event 6
  • 7. Signal Event • A signal is an explicit one-way transmission of information from one object to another • A signal event is the event of sending or receiving a signal. • Event is not like a subroutine call that returns a value – An object sending an event to another may expect a reply, but the reply is a separate event under the control of the second object, which may or may not choose to send it. – Note: A signal is a message between objects but a signal event is an occurrence in time 7
  • 8. Signal Class and Attributes 8
  • 9. Change Events • A change is an event that is caused by the satisfaction of a Boolean expression. • The uses of change event is tested continuously: whenever the expression changes from false to true • The UML notation : when keyword followed by a parenthesized Boolean expression • Example of change events – When (room temperature < heating set point) – When (room temperature > cooling set point) 9
  • 10. Time Events • A time event is an event caused by the occurrence of an absolute time or the elapse of a time interval. • The UML notation : The notation for a time interval is the keyword when / after followed by a parenthesized expression • Example of time events – When (date= January 1, 2014) – After (10 seconds) 10
  • 11. 2.States • It is often associated with a continuous activity. Ex. Telephone ringing • A STATE is an abstraction of the attribute values and links of an object • It has duration (occupies an interval of time) • A state is drawn as a rounded box containing an optional name 11
  • 12. State - Examples Waiting Dialing Powered Power turned on Power turned off Power turned on Powered Not Powered time
  • 13. Difference between states and events 13 States 1. Represent values of object 2. The attribute values and links held by an object 3. A state has duration. it occupies an interval of time 4. State separates two events Events 1. Represent external stimuli 2. An individual stimulus from one object to another 3. An event has no duration. It happens at a point of time 4. An event separates two states 13
  • 14. 3.Transitions • A change of state caused by an event is called transitions. • It is an instantaneous change from one state to another. • The source and target of a transition are different states or same state. • The choice of next state depends on both the original state and the event received. • The UML notation for a transition is a line with arrowhead from the source state to the target state • Example of transition: – When a called phone is answered, the phone line transitions from the Ringing state to the Connected state. 14
  • 15. 4.Conditions • A guard condition is a Boolean expression that must be true in order for a transition to occur. • A state can be defined in terms of a condition that valid over interval of time • Conditions can be used as guards on transitions • A guards transitions fires when its event occurs , but only if the guard condition is true • a guard condition is checked only once • A condition is listed within square brackets [] after an event name • For example – a person goes out in the morning (event), – if the temperature is below freezing (condition) , then put on your gloves(next state). 15
  • 16. 5.State Diagrams • A state diagram is a graph whose nodes are states and whose directed arcs are transitions labeled by an event names • A state diagram specifies the state sequences caused by event sequences. • State names must be unique within the scope of a state diagram • Note: state diagrams can implement by direct implementation or by converting into programming code 16
  • 17. 5.State Diagrams • The state model consists of multiple state diagrams, one state diagram for each class with important temporal behavior • State diagram contains sequences associated with normal call as well as abnormal call ( time out while dialing , getting busy line) • States can represent – continuous loops – one shot life cycles 17
  • 18. State diagram( continuous loop) for phone line 18
  • 19. One-shot life cycles • It represents objects with finite lives • It has initial and final states • The initial state is entered on creation of an object • An initial state is shown by a solid circle • The circle can be labeled to indicate different initial conditions • Final state implies destruction of the object • The final state shown by a bull’s eye. It distinguished from initial state 19
  • 20. State diagram(One-shot life cycles) for chess game 20
  • 21. Summary of Basic State Diagram Notation • The following Figure summarizes the basic UML syntax for state diagrams. 21 State diagram name State1 do / activity event / effect State2 ….. event (attribs) [condition]/effect 21
  • 22. 22
  • 23. 23
  • 24. 24