SlideShare a Scribd company logo
1 of 29
UML Sequence Diagrams 
Michael L. Collard, Ph.D. 
Department of Computer Science 
Kent State University
Types of Diagrams 
• Structural Diagrams – focus on static 
aspects of the software system 
– Class, Object, Component, Deployment 
• Behavioral Diagrams – focus on 
dynamic aspects of the software system 
– Use-case, Interaction, State Chart, 
Kent State University 2 
Activity
Behavioral Diagrams 
• Use Case Diagram – high-level behaviors of 
the system, user goals, external entities: 
actors 
• Sequence Diagram – focus on time ordering 
of messages 
• Collaboration Diagram – focus on structural 
organization of objects and messages 
• State Chart Diagram – event driven state 
changes of system 
• Activity Diagram – flow of control between 
activities 
Kent State University 3
Refining the Object Model 
• Typically, only very simplistic object models can be 
directly derived from use cases. 
• A better understanding of the behavior of each use 
case is necessary (i.e., analysis) 
• Use interaction diagrams to specify and detail the 
behavior of use cases 
• This helps to identify and refine key abstractions and 
relationships 
• Operations, attributes, and messages are also 
identified during this process 
Kent State University 4
Interaction Diagrams 
• There is one (or more) Interaction diagram per use 
case 
– Represent a sequence of interactions 
– Made up of objects, links, and messages 
• Sequence diagrams 
– Models flow of control by time ordering 
– Emphasizes passing messages wrt time 
– Shows simple iteration and branching 
• Collaboration diagrams 
– Models flow of control by organization 
– Structural relationships among instances in the interaction 
– Shows complex iteration and branching 
Kent State University 5
Example: Sequence Diagram 
c :c lie n t p :p la n n in g A s s is ta n t 
:T ic ke tA g e n t 
Kent State University 6 
< < c r e a te > > 
se tItin e r a r y ( i) 
ca lcu la te R o u te ( ) 
r o u te 
< < d e s tr o y> > 
n o tify ( )
Sequence Diagrams 
Kent State University 7 
• X-axis is objects 
– Object that initiates interaction is left most 
– Object to the right are increasingly more 
subordinate 
• Y-axis is time 
– Messages sent and received are ordered by time 
• Object life lines represent the existence over 
a period of time 
• Activation (double line) is the execution of the 
procedure.
Example: Sequence Diagram 
c :c lie n t p :p la n n in g A s s is ta n t 
:T ic ke tA g e n t 
Kent State University 8 
< < c r e a te > > 
se tItin e r a r y ( i) 
ca lcu la te R o u te ( ) 
r o u te 
< < d e s tr o y> > 
n o tify ( )
Message Passing 
• Send – sends a signal (message) to an 
object 
• Return – returns a value to a caller 
• Call – invoke an operation 
call 
• Stereotypes 
send 
– <<create>> 
Return 
– <<destroy>> 
Kent State University 9
Example: Sequence Diagram 
c :c lie n t p :p la n n in g A s s is ta n t 
:T ic ke tA g e n t 
Kent State University 10 
< < c r e a te > > 
se tItin e r a r y ( i) 
ca lcu la te R o u te ( ) 
r o u te 
< < d e s tr o y> > 
n o tify ( )
Example 
S : sam p le r W D : se n so r s W S : se n so r s T em p : se n so r s H um : se n so r s 
Kent State University 11 
E v e r y 1 / 6 0 s e c . 
E v e r y 0 . 5 s e c . 
E v e r y 5 m i n .
Properties of Sequence 
Diagrams 
• Initiator is leftmost object (boundary 
object) 
• Next is typically a control object 
• Then comes entity objects 
Kent State University 12
Collaboration Diagrams 
• Emphasizes the organization of the 
objects that participate in an interaction 
• Classifier roles 
• Association 
• Messages, flow, and sequencing 
Kent State University 13
Example Collaboration 
Diagram 
R e q u e s t( o r d e r , cu s to m e r ) 2 : co s t:= r e se a r ce ( o r d e r ) 
o r d e r T a ke r T ic ke tD B 
3: d eb it(cu s tome rco s t) 
Kent State University 14 
C r e d itB u r e a u 
1 : ch e c kCr ed it(cu s to me r)
Collaboration vs Sequence 
• The two diagrams really show the same 
information 
• Collaboration diagrams show more 
static structure (however, class 
diagrams are better at this) 
• Sequence diagrams clearly highlight the 
orderings and very useful for multi-tasking 
Kent State University 15
Summary (Interaction 
Diagrams) 
• Well structured interaction diagrams: 
– Is focused on communicating one aspect of a 
system’s dynamics 
– Contains only those elements that are essential to 
understanding 
– Is not so minimal that it misinforms the reader 
about the semantics that are important 
• Diagrams should have meaningful names 
• Layout diagram to minimize line crossings 
• Use branching sparingly (leave for activity 
diagram) 
Kent State University 16
State Diagrams 
• Finite state machines (i.e., automata, 
Mealy/Moore, state transition) 
• Used to describe the behavior of one object 
(or sometimes an operator) for a number of 
scenarios that affect the object 
• They are not good for showing interaction 
between objects (use interaction diagrams) 
• Only use when the behavior of a object is 
complex and more detail is needed 
Kent State University 17
State Diagram Features 
• Event – something that happens at a specific 
point 
– Alarm goes off 
• Condition – something that has a duration 
– Alarm is on 
– Fuel level is low 
• State – an abstraction of the attributes and 
relationships of an object (or system) 
– The fuel tank is in a too low level when the fuel 
level is below level x for n seconds 
Kent State University 18
Example: on/off Switch 
/ FlipSwitch 
on off 
/ FlipSwitch 
Kent State University 19
Using guards and actions 
trigger event guard 
Kent State University 20 
Waiting 
Confirm 
credit Cancel 
order 
Process 
order 
recieveOrder [amount<25] 
recieveOrder [amount>25] 
approve / debitAccount() 
reject 
action
Activity Diagrams 
• Special form of a state machine (flow 
chart) – intended to model 
computations and workflows 
• States of the executing the computation 
not the states of an object 
• Flow between activity states is caused 
by the end of a computation rather then 
an event 
Kent State University 21
Why Activity Diagrams 
• Flowcharts (abet a bit glorified) are not 
very amiable to OO 
• Not part of any previous notations 
• Suitable for modeling the business 
activities 
• OO and UML is becoming very 
prevalent in business applications 
• Introduced to help sell products? 
Kent State University 22
Component Diagrams 
• A component is a physical thing that 
conforms to and realizes a set of interfaces 
• Bridge between logical and physical models 
• Can represent object libraries, COM 
components, Java Beans, etc. 
• Classes represent logical abstractions, 
components represent physical things that 
reside on a node (machine). 
• Components are reachable only through 
interface 
Kent State University 23
Examples 
«table» 
ATM-GUI Account 
Transactions 
Kent State University 24 
U p d a t e 
s p e l l - c h e c k 
Dictionary s y n o n y m s 
a d d - n e w - w o r d
Deployment Diagrams 
• Nodes are physical elements that represent a 
computational resource (machine) 
• Association between nodes 
• Components are allocated to nodes (one or 
more) 
• Components represent the physical 
packaging of logical elements 
• Nodes represent the physical deployment of 
components 
Kent State University 25
Example 
BankServer 
* -Server 
* -Client 
ATMKiosk 
Kent State University 26
With Components 
T r a n s a c t i o n s 
Kent State University 27 
BankServer 
ATMKiosk 
1 -server 
* -client 
A T M - G U I 
«table» 
A c c o u n t 
Update
Weather Station 
Clock 
Computer 
LCD 
Display 
Kent State University 28 
Keypad 
Wind 
Direction 
Sensor 
Wind 
Speed 
Sensor 
Tempature 
Sensor Humidity 
Sensor Barometer
Modeling Source Code 
Kent State University 29 
M a i l b o x . c p p 
M a i l b o x . h 
M a i l s y s t e m . c p p 
I n p u t r e a d e r . h

More Related Content

What's hot

Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
mewaseem
 
3 Tier Architecture
3  Tier Architecture3  Tier Architecture
3 Tier Architecture
Webx
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
Haitham El-Ghareeb
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mapping
saurabhshertukde
 

What's hot (20)

Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
 
Sequence diagrame
Sequence diagrameSequence diagrame
Sequence diagrame
 
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
 
08 state diagram and activity diagram
08 state diagram and activity diagram08 state diagram and activity diagram
08 state diagram and activity diagram
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
 
UML
UMLUML
UML
 
Sequence diagram- UML diagram
Sequence diagram- UML diagramSequence diagram- UML diagram
Sequence diagram- UML diagram
 
3 Tier Architecture
3  Tier Architecture3  Tier Architecture
3 Tier Architecture
 
SAD11 - Sequence Diagrams
SAD11 - Sequence DiagramsSAD11 - Sequence Diagrams
SAD11 - Sequence Diagrams
 
Use Case Modeling
Use Case ModelingUse Case Modeling
Use Case Modeling
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram
 
10 component diagram
10 component diagram10 component diagram
10 component diagram
 
Ooad unit – 1 introduction
Ooad unit – 1 introductionOoad unit – 1 introduction
Ooad unit – 1 introduction
 
UML
UMLUML
UML
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
 
UML and Software Modeling Tools.pptx
UML and Software Modeling Tools.pptxUML and Software Modeling Tools.pptx
UML and Software Modeling Tools.pptx
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
UML diagrams and symbols
UML diagrams and symbolsUML diagrams and symbols
UML diagrams and symbols
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mapping
 

Similar to Uml sequence diagrams

Introduction to simulink (1)
Introduction to simulink (1)Introduction to simulink (1)
Introduction to simulink (1)
Memo Love
 
Lecture#03, uml diagrams
Lecture#03, uml diagramsLecture#03, uml diagrams
Lecture#03, uml diagrams
babak danyal
 
UML Design Document Training Learn UML .pptx
UML Design Document Training Learn UML .pptxUML Design Document Training Learn UML .pptx
UML Design Document Training Learn UML .pptx
raghavanp4
 
Structured system analysis
Structured system analysisStructured system analysis
Structured system analysis
learnt
 

Similar to Uml sequence diagrams (20)

CS8592-OOAD Lecture Notes Unit-3
CS8592-OOAD Lecture Notes Unit-3CS8592-OOAD Lecture Notes Unit-3
CS8592-OOAD Lecture Notes Unit-3
 
Introduction to simulink (1)
Introduction to simulink (1)Introduction to simulink (1)
Introduction to simulink (1)
 
Analysis modeling
Analysis modelingAnalysis modeling
Analysis modeling
 
OOAD UNIT I UML DIAGRAMS
OOAD UNIT I UML DIAGRAMSOOAD UNIT I UML DIAGRAMS
OOAD UNIT I UML 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)
 
LECTURE 9 (Week 5) - Behavioral Diagrams.pptx
LECTURE 9 (Week 5) - Behavioral Diagrams.pptxLECTURE 9 (Week 5) - Behavioral Diagrams.pptx
LECTURE 9 (Week 5) - Behavioral Diagrams.pptx
 
Java
Java   Java
Java
 
02_IT4557.pptx
02_IT4557.pptx02_IT4557.pptx
02_IT4557.pptx
 
Lecture#03, uml diagrams
Lecture#03, uml diagramsLecture#03, uml diagrams
Lecture#03, uml diagrams
 
Laser 1-background
Laser 1-backgroundLaser 1-background
Laser 1-background
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
 
Unit 1- OOAD ppt
Unit 1- OOAD  pptUnit 1- OOAD  ppt
Unit 1- OOAD ppt
 
Quality Tools & Techniques Presentation.pptx
Quality Tools & Techniques Presentation.pptxQuality Tools & Techniques Presentation.pptx
Quality Tools & Techniques Presentation.pptx
 
UML Design Document Training Learn UML .pptx
UML Design Document Training Learn UML .pptxUML Design Document Training Learn UML .pptx
UML Design Document Training Learn UML .pptx
 
Basic Behavioral Modeling
Basic Behavioral ModelingBasic Behavioral Modeling
Basic Behavioral Modeling
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
Oed chapter 1
Oed chapter 1Oed chapter 1
Oed chapter 1
 
Structured system analysis
Structured system analysisStructured system analysis
Structured system analysis
 
Jar chapter 4, part 1
Jar chapter 4, part 1Jar chapter 4, part 1
Jar chapter 4, part 1
 
Cs8592 ooad unit 1
Cs8592 ooad unit 1Cs8592 ooad unit 1
Cs8592 ooad unit 1
 

Uml sequence diagrams

  • 1. UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University
  • 2. Types of Diagrams • Structural Diagrams – focus on static aspects of the software system – Class, Object, Component, Deployment • Behavioral Diagrams – focus on dynamic aspects of the software system – Use-case, Interaction, State Chart, Kent State University 2 Activity
  • 3. Behavioral Diagrams • Use Case Diagram – high-level behaviors of the system, user goals, external entities: actors • Sequence Diagram – focus on time ordering of messages • Collaboration Diagram – focus on structural organization of objects and messages • State Chart Diagram – event driven state changes of system • Activity Diagram – flow of control between activities Kent State University 3
  • 4. Refining the Object Model • Typically, only very simplistic object models can be directly derived from use cases. • A better understanding of the behavior of each use case is necessary (i.e., analysis) • Use interaction diagrams to specify and detail the behavior of use cases • This helps to identify and refine key abstractions and relationships • Operations, attributes, and messages are also identified during this process Kent State University 4
  • 5. Interaction Diagrams • There is one (or more) Interaction diagram per use case – Represent a sequence of interactions – Made up of objects, links, and messages • Sequence diagrams – Models flow of control by time ordering – Emphasizes passing messages wrt time – Shows simple iteration and branching • Collaboration diagrams – Models flow of control by organization – Structural relationships among instances in the interaction – Shows complex iteration and branching Kent State University 5
  • 6. Example: Sequence Diagram c :c lie n t p :p la n n in g A s s is ta n t :T ic ke tA g e n t Kent State University 6 < < c r e a te > > se tItin e r a r y ( i) ca lcu la te R o u te ( ) r o u te < < d e s tr o y> > n o tify ( )
  • 7. Sequence Diagrams Kent State University 7 • X-axis is objects – Object that initiates interaction is left most – Object to the right are increasingly more subordinate • Y-axis is time – Messages sent and received are ordered by time • Object life lines represent the existence over a period of time • Activation (double line) is the execution of the procedure.
  • 8. Example: Sequence Diagram c :c lie n t p :p la n n in g A s s is ta n t :T ic ke tA g e n t Kent State University 8 < < c r e a te > > se tItin e r a r y ( i) ca lcu la te R o u te ( ) r o u te < < d e s tr o y> > n o tify ( )
  • 9. Message Passing • Send – sends a signal (message) to an object • Return – returns a value to a caller • Call – invoke an operation call • Stereotypes send – <<create>> Return – <<destroy>> Kent State University 9
  • 10. Example: Sequence Diagram c :c lie n t p :p la n n in g A s s is ta n t :T ic ke tA g e n t Kent State University 10 < < c r e a te > > se tItin e r a r y ( i) ca lcu la te R o u te ( ) r o u te < < d e s tr o y> > n o tify ( )
  • 11. Example S : sam p le r W D : se n so r s W S : se n so r s T em p : se n so r s H um : se n so r s Kent State University 11 E v e r y 1 / 6 0 s e c . E v e r y 0 . 5 s e c . E v e r y 5 m i n .
  • 12. Properties of Sequence Diagrams • Initiator is leftmost object (boundary object) • Next is typically a control object • Then comes entity objects Kent State University 12
  • 13. Collaboration Diagrams • Emphasizes the organization of the objects that participate in an interaction • Classifier roles • Association • Messages, flow, and sequencing Kent State University 13
  • 14. Example Collaboration Diagram R e q u e s t( o r d e r , cu s to m e r ) 2 : co s t:= r e se a r ce ( o r d e r ) o r d e r T a ke r T ic ke tD B 3: d eb it(cu s tome rco s t) Kent State University 14 C r e d itB u r e a u 1 : ch e c kCr ed it(cu s to me r)
  • 15. Collaboration vs Sequence • The two diagrams really show the same information • Collaboration diagrams show more static structure (however, class diagrams are better at this) • Sequence diagrams clearly highlight the orderings and very useful for multi-tasking Kent State University 15
  • 16. Summary (Interaction Diagrams) • Well structured interaction diagrams: – Is focused on communicating one aspect of a system’s dynamics – Contains only those elements that are essential to understanding – Is not so minimal that it misinforms the reader about the semantics that are important • Diagrams should have meaningful names • Layout diagram to minimize line crossings • Use branching sparingly (leave for activity diagram) Kent State University 16
  • 17. State Diagrams • Finite state machines (i.e., automata, Mealy/Moore, state transition) • Used to describe the behavior of one object (or sometimes an operator) for a number of scenarios that affect the object • They are not good for showing interaction between objects (use interaction diagrams) • Only use when the behavior of a object is complex and more detail is needed Kent State University 17
  • 18. State Diagram Features • Event – something that happens at a specific point – Alarm goes off • Condition – something that has a duration – Alarm is on – Fuel level is low • State – an abstraction of the attributes and relationships of an object (or system) – The fuel tank is in a too low level when the fuel level is below level x for n seconds Kent State University 18
  • 19. Example: on/off Switch / FlipSwitch on off / FlipSwitch Kent State University 19
  • 20. Using guards and actions trigger event guard Kent State University 20 Waiting Confirm credit Cancel order Process order recieveOrder [amount<25] recieveOrder [amount>25] approve / debitAccount() reject action
  • 21. Activity Diagrams • Special form of a state machine (flow chart) – intended to model computations and workflows • States of the executing the computation not the states of an object • Flow between activity states is caused by the end of a computation rather then an event Kent State University 21
  • 22. Why Activity Diagrams • Flowcharts (abet a bit glorified) are not very amiable to OO • Not part of any previous notations • Suitable for modeling the business activities • OO and UML is becoming very prevalent in business applications • Introduced to help sell products? Kent State University 22
  • 23. Component Diagrams • A component is a physical thing that conforms to and realizes a set of interfaces • Bridge between logical and physical models • Can represent object libraries, COM components, Java Beans, etc. • Classes represent logical abstractions, components represent physical things that reside on a node (machine). • Components are reachable only through interface Kent State University 23
  • 24. Examples «table» ATM-GUI Account Transactions Kent State University 24 U p d a t e s p e l l - c h e c k Dictionary s y n o n y m s a d d - n e w - w o r d
  • 25. Deployment Diagrams • Nodes are physical elements that represent a computational resource (machine) • Association between nodes • Components are allocated to nodes (one or more) • Components represent the physical packaging of logical elements • Nodes represent the physical deployment of components Kent State University 25
  • 26. Example BankServer * -Server * -Client ATMKiosk Kent State University 26
  • 27. With Components T r a n s a c t i o n s Kent State University 27 BankServer ATMKiosk 1 -server * -client A T M - G U I «table» A c c o u n t Update
  • 28. Weather Station Clock Computer LCD Display Kent State University 28 Keypad Wind Direction Sensor Wind Speed Sensor Tempature Sensor Humidity Sensor Barometer
  • 29. Modeling Source Code Kent State University 29 M a i l b o x . c p p M a i l b o x . h M a i l s y s t e m . c p p I n p u t r e a d e r . h