SlideShare une entreprise Scribd logo
1  sur  24
State Diagrams
Object-Oriented Software Systems Engineering – Chapter 5 Slide 1
Objectives
Object-Oriented Software Systems Engineering – Chapter 5 Slide 2
In this chapter we will:
Introduce the terms used with respect to state
diagrams
Discuss the context in which state diagrams are
used
Introduce substates
Discuss concurrent state diagrams
Statechart Diagrams
Object-Oriented Software Systems Engineering – Chapter 5 Slide 3
State diagrams describe the life of an object using
three main elements:
States of an object
Transitions between states
Events that trigger the transitions
A state diagram or statechart specifies a state
machine
A state machine is described for a class
Each object has it’s own state machine
Why Use Statechart Diagrams?
Object-Oriented Software Systems Engineering – Chapter 5 Slide 4
Statecharts typically are used to describe state-dependent
behaviour for an object
An object responds differently to the same event depending on
what state it is in
Usually applied to objects but can be applied to anyelement
that has behaviour
Actors, use cases, methods, subsystems, systems
Statecharts are typically used in conjunction with interaction
diagrams (usually sequence diagrams)
A statechart describes all events (and states and transitionsfor
a single object)
A sequence diagram describes the events for asingle
interaction across all objects involved
States
Object-Oriented Software Systems Engineering – Chapter 5 Slide 5
Show what the dependencies are between the
state of an object and its reactions to messages
or other events
State
is a condition or situation during the life of an object
within which it performs some activity, or waits for some
events
Has a name
Has actions -- execute the state
Has internal transitions -- transitions cause no change in
a state
substates -- the nested structure of a state involving
disjoint or concurrent substates
States
For example:
At Work
entry/unlock door
do/prepare materials
telephone rings/answer telephone
include/lecture state
exit/lock door
state name
action performed on entry to state
activity performed while in state
action performed on arrival of named event
name of a sub-state machine
action performed on leaving state
Object-Oriented Software Systems Engineering – Chapter 5 Slide 6
Initial and Final States
Object-Oriented Software Systems Engineering – Chapter 5 Slide 7
The initial state of a state machine is indicated
with a solid circle
Known as a pseudo-state
A transition from this state will show the first real state
The final state of a state machine is shown as
concentric circles
A closed loop state machine does not have a final state;
the object lives until the entire system terminates
An open loop state machine represents an object that
may terminate before the system terminates
Initial and Final States
An example:
At Work At Home
go home
go to work
die
Object-Oriented Software Systems Engineering – Chapter 5 Slide 8
die
Actions and Activities
Object-Oriented Software Systems Engineering – Chapter 5 Slide 13
Action
is an executable atomic computation
includes operation calls, the creation or destruction of
another object, or the sending of a signal to an object
associated with transitions and during which an action is
not interruptible -- e.g., entry, exit
Activity is associated with states
Non-atomic or ongoing computation
May run to completion or continue indefinitely
Will be terminated by an event that causes a transition
from the state in which the activity is defined
Events
Object-Oriented Software Systems Engineering – Chapter 5 Slide 14
An event signature is described as
Event-name (comma-separated-parameter-list)
Events appear in the internal transition
compartment of a state or on a transition between
states
An event may be one of four types
Signal event
Corresponding to the arrival of an asynchronous message
or signal
Call event
Corresponding to the arrival of a procedural call to an
operation
Time event
Change event
Events
Object-Oriented Software Systems Engineering – Chapter 5 Slide 15
A time event occurs after a specified time has
elapsed
Event name is specified as keyword after
Parameter list is an expression evaluating to a time
interval
after(10 seconds after state “At Work” is entered)
No specified start time implies “since entry to the current
state”
after(2 seconds)
Events
Object-Oriented Software Systems Engineering – Chapter 5 Slide 16
A change event occurs whenever a specified
condition is met
Event name is specified as keyword when
Parameter list is a boolean expression
The event occurs when both of the following conditions
are met, irrespective of the order when they happen
The expression evaluates to true
The object is in the required state
For example
when (state = At Work)
when (date = January 1 2007)
Transitions
Object-Oriented Software Systems Engineering – Chapter 5 Slide 17
A transition is drawn as an arrow between states
annotated with a transition string
The transition string denotes the event and
consequent action
Only one form of arrowhead is used on statecharts
The distinction between call events and signal events must be
deducted from elsewhere e.g. an interaction diagram
A transition string is described as
Event-signature [guard-condition]/action-expression^object.message
If the guard condition is met the transition occurs immediately
Transitions
Object-Oriented Software Systems Engineering – Chapter 5 Slide 18
A transition whose string contains neither an
event signature nor a guard condition is said to be
unlabeled
Occurs immediately
May still carry an action expression
Transitions
Object-Oriented Software Systems Engineering – Chapter 5 Slide 19
A transition is triggered when its event occurs
If the guard condition is met, the transition is fired
If the condition is not met the event is discarded
The guard condition is checked only once
If there is no guard condition, triggering will
always cause firing
Note the distinction between a guard condition
and a change event
A guard condition is evaluated once, when the
associated event occurs
A change event occurs whenever its associated
condition is met
Behaviour is as if the condition were being continually
evaluated
State Diagrams notation
Paid
Unpaid
paying
Invoice
created
Invoice
destroyed
name
state
final state
Initial state
transition
event
Object-Oriented Software Systems Engineering – Chapter 5 Slide 20
State Diagram Example
Checking
do / check
Item
Dispatching
do / initiate
delivery
Ordering Delivering
*[all items checked]
get next item
[all items checked
&& some items not
in stock]
Order Item
Dispatch items
delivery
get first item
[all items checked &&
all items available]
cancelled
Exit/ Item received
do / order Item
entry / deliver
Items
Canceling
do / Remove
Item
some items
not in stock
all items
in stock
Object-Oriented Software Systems Engineering – Chapter 5 Slide 21
State Diagram - Nested States
Super-state
A B
event-1
C
event-2
A B
C
event-1
event-2
event-2
Object-Oriented Software Systems Engineering – Chapter 5 Slide 22
Checking
do / check
Item
Dispatching
do / initiate
delivery
Delivering
[all items checked &&
some items not in stock]
Order item
[all items checked && all items available]
Dispatch items
delivery
get first item
Canceling
cancelled
Ordering
Exit/ Item received
do / order Item
Object-Oriented Software Systems Engineering – Chapter 5 Slide 23
*[all items checked]
get next item
entry / deliver
Items
do / Remove
Item
State Diagram Example including substates
Concurrent State models
Orthogonal Components and Concurrency
shown separated by dashed line
supports concurrency
Objects must be in only one state from each of the
orthogonal components
Starting
A
Finishing
B
C
E
F
D G
Explicit control
branching(fork)
s
Object-Oriented Software Systems Engineering – Chapter 5 Slide 24
T

Contenu connexe

Similaire à STATE DIAGRAM.pptx

SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsAmr E. Mohamed
 
discrete-event-simulation-190410063238.pptx
discrete-event-simulation-190410063238.pptxdiscrete-event-simulation-190410063238.pptx
discrete-event-simulation-190410063238.pptxubaidullah75790
 
state modeling In UML
state modeling In UMLstate modeling In UML
state modeling In UMLKumar
 
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 DiagramsAmr E. Mohamed
 
C:\documents and settings\student\desktop\swaroop uml
C:\documents and settings\student\desktop\swaroop umlC:\documents and settings\student\desktop\swaroop uml
C:\documents and settings\student\desktop\swaroop umlsatyaiswaroop
 
Programming models for event controlled programs
Programming models for event controlled programsProgramming models for event controlled programs
Programming models for event controlled programsPriya Kaushal
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramAjit Nayak
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! EdholeEdhole.com
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! EdholeEdhole.com
 
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)Manoj Reddy
 
Unit three Advanced State Modelling
Unit three Advanced State ModellingUnit three Advanced State Modelling
Unit three Advanced State ModellingDr Chetan Shelke
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 

Similaire à STATE DIAGRAM.pptx (20)

Ooad ch 5
Ooad ch 5Ooad ch 5
Ooad ch 5
 
State modeling
State modelingState modeling
State modeling
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
 
discrete-event-simulation-190410063238.pptx
discrete-event-simulation-190410063238.pptxdiscrete-event-simulation-190410063238.pptx
discrete-event-simulation-190410063238.pptx
 
Step types
Step typesStep types
Step types
 
Ooad 3
Ooad 3Ooad 3
Ooad 3
 
state modeling In UML
state modeling In UMLstate modeling In UML
state modeling In UML
 
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
 
C:\documents and settings\student\desktop\swaroop uml
C:\documents and settings\student\desktop\swaroop umlC:\documents and settings\student\desktop\swaroop uml
C:\documents and settings\student\desktop\swaroop uml
 
Programming models for event controlled programs
Programming models for event controlled programsProgramming models for event controlled programs
Programming models for event controlled programs
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State 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
 
Java
Java   Java
Java
 
Discrete event-simulation
Discrete event-simulationDiscrete event-simulation
Discrete event-simulation
 
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)
 
Unit three Advanced State Modelling
Unit three Advanced State ModellingUnit three Advanced State Modelling
Unit three Advanced State Modelling
 
Jar chapter 4, part 1
Jar chapter 4, part 1Jar chapter 4, part 1
Jar chapter 4, part 1
 
UML.pptx
UML.pptxUML.pptx
UML.pptx
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 

Plus de ssuser2d043c

sfdgdfgfgfdgvsdfdsfedrfewsfdsfsfterfdcm.ppt
sfdgdfgfgfdgvsdfdsfedrfewsfdsfsfterfdcm.pptsfdgdfgfgfdgvsdfdsfedrfewsfdsfsfterfdcm.ppt
sfdgdfgfgfdgvsdfdsfedrfewsfdsfsfterfdcm.pptssuser2d043c
 
ch11lect1.pptghjgjhjkkljkkkjkjkjljkjhytytgh
ch11lect1.pptghjgjhjkkljkkkjkjkjljkjhytytghch11lect1.pptghjgjhjkkljkkkjkjkjljkjhytytgh
ch11lect1.pptghjgjhjkkljkkkjkjkjljkjhytytghssuser2d043c
 
cocomo-220726173706-141e0dsdsd8f0 (1).pdf
cocomo-220726173706-141e0dsdsd8f0 (1).pdfcocomo-220726173706-141e0dsdsd8f0 (1).pdf
cocomo-220726173706-141e0dsdsd8f0 (1).pdfssuser2d043c
 
pointer in c through addressing modes esntial in c
pointer in c through addressing modes esntial in cpointer in c through addressing modes esntial in c
pointer in c through addressing modes esntial in cssuser2d043c
 
System engineering is related to software engineering
System engineering is related to software engineeringSystem engineering is related to software engineering
System engineering is related to software engineeringssuser2d043c
 
Session 01 (Introduction).pdf
Session 01 (Introduction).pdfSession 01 (Introduction).pdf
Session 01 (Introduction).pdfssuser2d043c
 

Plus de ssuser2d043c (12)

sfdgdfgfgfdgvsdfdsfedrfewsfdsfsfterfdcm.ppt
sfdgdfgfgfdgvsdfdsfedrfewsfdsfsfterfdcm.pptsfdgdfgfgfdgvsdfdsfedrfewsfdsfsfterfdcm.ppt
sfdgdfgfgfdgvsdfdsfedrfewsfdsfsfterfdcm.ppt
 
ch11lect1.pptghjgjhjkkljkkkjkjkjljkjhytytgh
ch11lect1.pptghjgjhjkkljkkkjkjkjljkjhytytghch11lect1.pptghjgjhjkkljkkkjkjkjljkjhytytgh
ch11lect1.pptghjgjhjkkljkkkjkjkjljkjhytytgh
 
cocomo-220726173706-141e0dsdsd8f0 (1).pdf
cocomo-220726173706-141e0dsdsd8f0 (1).pdfcocomo-220726173706-141e0dsdsd8f0 (1).pdf
cocomo-220726173706-141e0dsdsd8f0 (1).pdf
 
pointer in c through addressing modes esntial in c
pointer in c through addressing modes esntial in cpointer in c through addressing modes esntial in c
pointer in c through addressing modes esntial in c
 
System engineering is related to software engineering
System engineering is related to software engineeringSystem engineering is related to software engineering
System engineering is related to software engineering
 
1_Overview.pdf
1_Overview.pdf1_Overview.pdf
1_Overview.pdf
 
software
softwaresoftware
software
 
lecture 1.pdf
lecture 1.pdflecture 1.pdf
lecture 1.pdf
 
pig intro.pdf
pig intro.pdfpig intro.pdf
pig intro.pdf
 
Session 01 (Introduction).pdf
Session 01 (Introduction).pdfSession 01 (Introduction).pdf
Session 01 (Introduction).pdf
 
data 1.ppt
data 1.pptdata 1.ppt
data 1.ppt
 
IntroToOOP.ppt
IntroToOOP.pptIntroToOOP.ppt
IntroToOOP.ppt
 

Dernier

办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一F dds
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造kbdhl05e
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degreeyuu sss
 
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...Yantram Animation Studio Corporation
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证nhjeo1gg
 
group_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfgroup_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfneelspinoy
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdfvaibhavkanaujia
 
Call Girls Meghani Nagar 7397865700 Independent Call Girls
Call Girls Meghani Nagar 7397865700  Independent Call GirlsCall Girls Meghani Nagar 7397865700  Independent Call Girls
Call Girls Meghani Nagar 7397865700 Independent Call Girlsssuser7cb4ff
 
306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social MediaD SSS
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一z xss
 
How to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIHow to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIyuj
 
Untitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxUntitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxmapanig881
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一Fi L
 
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts ServiceCall Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Servicejennyeacort
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfShivakumar Viswanathan
 
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一Fi ss
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Rndexperts
 
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
PORTAFOLIO   2024_  ANASTASIYA  KUDINOVAPORTAFOLIO   2024_  ANASTASIYA  KUDINOVA
PORTAFOLIO 2024_ ANASTASIYA KUDINOVAAnastasiya Kudinova
 

Dernier (20)

办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造
 
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
专业一比一美国亚利桑那大学毕业证成绩单pdf电子版制作修改#真实工艺展示#真实防伪#diploma#degree
 
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
Unveiling the Future: Columbus, Ohio Condominiums Through the Lens of 3D Arch...
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
 
group_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfgroup_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdf
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdf
 
Call Girls Meghani Nagar 7397865700 Independent Call Girls
Call Girls Meghani Nagar 7397865700  Independent Call GirlsCall Girls Meghani Nagar 7397865700  Independent Call Girls
Call Girls Meghani Nagar 7397865700 Independent Call Girls
 
306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
 
Call Girls in Pratap Nagar, 9953056974 Escort Service
Call Girls in Pratap Nagar,  9953056974 Escort ServiceCall Girls in Pratap Nagar,  9953056974 Escort Service
Call Girls in Pratap Nagar, 9953056974 Escort Service
 
How to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AIHow to Empower the future of UX Design with Gen AI
How to Empower the future of UX Design with Gen AI
 
Untitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxUntitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptx
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
 
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts ServiceCall Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdf
 
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
定制(CQU文凭证书)中央昆士兰大学毕业证成绩单原版一比一
 
Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025Top 10 Modern Web Design Trends for 2025
Top 10 Modern Web Design Trends for 2025
 
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
PORTAFOLIO   2024_  ANASTASIYA  KUDINOVAPORTAFOLIO   2024_  ANASTASIYA  KUDINOVA
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
 

STATE DIAGRAM.pptx

  • 1. State Diagrams Object-Oriented Software Systems Engineering – Chapter 5 Slide 1
  • 2. Objectives Object-Oriented Software Systems Engineering – Chapter 5 Slide 2 In this chapter we will: Introduce the terms used with respect to state diagrams Discuss the context in which state diagrams are used Introduce substates Discuss concurrent state diagrams
  • 3. Statechart Diagrams Object-Oriented Software Systems Engineering – Chapter 5 Slide 3 State diagrams describe the life of an object using three main elements: States of an object Transitions between states Events that trigger the transitions A state diagram or statechart specifies a state machine A state machine is described for a class Each object has it’s own state machine
  • 4. Why Use Statechart Diagrams? Object-Oriented Software Systems Engineering – Chapter 5 Slide 4 Statecharts typically are used to describe state-dependent behaviour for an object An object responds differently to the same event depending on what state it is in Usually applied to objects but can be applied to anyelement that has behaviour Actors, use cases, methods, subsystems, systems Statecharts are typically used in conjunction with interaction diagrams (usually sequence diagrams) A statechart describes all events (and states and transitionsfor a single object) A sequence diagram describes the events for asingle interaction across all objects involved
  • 5. States Object-Oriented Software Systems Engineering – Chapter 5 Slide 5 Show what the dependencies are between the state of an object and its reactions to messages or other events State is a condition or situation during the life of an object within which it performs some activity, or waits for some events Has a name Has actions -- execute the state Has internal transitions -- transitions cause no change in a state substates -- the nested structure of a state involving disjoint or concurrent substates
  • 6. States For example: At Work entry/unlock door do/prepare materials telephone rings/answer telephone include/lecture state exit/lock door state name action performed on entry to state activity performed while in state action performed on arrival of named event name of a sub-state machine action performed on leaving state Object-Oriented Software Systems Engineering – Chapter 5 Slide 6
  • 7. Initial and Final States Object-Oriented Software Systems Engineering – Chapter 5 Slide 7 The initial state of a state machine is indicated with a solid circle Known as a pseudo-state A transition from this state will show the first real state The final state of a state machine is shown as concentric circles A closed loop state machine does not have a final state; the object lives until the entire system terminates An open loop state machine represents an object that may terminate before the system terminates
  • 8. Initial and Final States An example: At Work At Home go home go to work die Object-Oriented Software Systems Engineering – Chapter 5 Slide 8 die
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Actions and Activities Object-Oriented Software Systems Engineering – Chapter 5 Slide 13 Action is an executable atomic computation includes operation calls, the creation or destruction of another object, or the sending of a signal to an object associated with transitions and during which an action is not interruptible -- e.g., entry, exit Activity is associated with states Non-atomic or ongoing computation May run to completion or continue indefinitely Will be terminated by an event that causes a transition from the state in which the activity is defined
  • 14. Events Object-Oriented Software Systems Engineering – Chapter 5 Slide 14 An event signature is described as Event-name (comma-separated-parameter-list) Events appear in the internal transition compartment of a state or on a transition between states An event may be one of four types Signal event Corresponding to the arrival of an asynchronous message or signal Call event Corresponding to the arrival of a procedural call to an operation Time event Change event
  • 15. Events Object-Oriented Software Systems Engineering – Chapter 5 Slide 15 A time event occurs after a specified time has elapsed Event name is specified as keyword after Parameter list is an expression evaluating to a time interval after(10 seconds after state “At Work” is entered) No specified start time implies “since entry to the current state” after(2 seconds)
  • 16. Events Object-Oriented Software Systems Engineering – Chapter 5 Slide 16 A change event occurs whenever a specified condition is met Event name is specified as keyword when Parameter list is a boolean expression The event occurs when both of the following conditions are met, irrespective of the order when they happen The expression evaluates to true The object is in the required state For example when (state = At Work) when (date = January 1 2007)
  • 17. Transitions Object-Oriented Software Systems Engineering – Chapter 5 Slide 17 A transition is drawn as an arrow between states annotated with a transition string The transition string denotes the event and consequent action Only one form of arrowhead is used on statecharts The distinction between call events and signal events must be deducted from elsewhere e.g. an interaction diagram A transition string is described as Event-signature [guard-condition]/action-expression^object.message If the guard condition is met the transition occurs immediately
  • 18. Transitions Object-Oriented Software Systems Engineering – Chapter 5 Slide 18 A transition whose string contains neither an event signature nor a guard condition is said to be unlabeled Occurs immediately May still carry an action expression
  • 19. Transitions Object-Oriented Software Systems Engineering – Chapter 5 Slide 19 A transition is triggered when its event occurs If the guard condition is met, the transition is fired If the condition is not met the event is discarded The guard condition is checked only once If there is no guard condition, triggering will always cause firing Note the distinction between a guard condition and a change event A guard condition is evaluated once, when the associated event occurs A change event occurs whenever its associated condition is met Behaviour is as if the condition were being continually evaluated
  • 20. State Diagrams notation Paid Unpaid paying Invoice created Invoice destroyed name state final state Initial state transition event Object-Oriented Software Systems Engineering – Chapter 5 Slide 20
  • 21. State Diagram Example Checking do / check Item Dispatching do / initiate delivery Ordering Delivering *[all items checked] get next item [all items checked && some items not in stock] Order Item Dispatch items delivery get first item [all items checked && all items available] cancelled Exit/ Item received do / order Item entry / deliver Items Canceling do / Remove Item some items not in stock all items in stock Object-Oriented Software Systems Engineering – Chapter 5 Slide 21
  • 22. State Diagram - Nested States Super-state A B event-1 C event-2 A B C event-1 event-2 event-2 Object-Oriented Software Systems Engineering – Chapter 5 Slide 22
  • 23. Checking do / check Item Dispatching do / initiate delivery Delivering [all items checked && some items not in stock] Order item [all items checked && all items available] Dispatch items delivery get first item Canceling cancelled Ordering Exit/ Item received do / order Item Object-Oriented Software Systems Engineering – Chapter 5 Slide 23 *[all items checked] get next item entry / deliver Items do / Remove Item State Diagram Example including substates
  • 24. Concurrent State models Orthogonal Components and Concurrency shown separated by dashed line supports concurrency Objects must be in only one state from each of the orthogonal components Starting A Finishing B C E F D G Explicit control branching(fork) s Object-Oriented Software Systems Engineering – Chapter 5 Slide 24 T