Interaction Models (2): Sequence Diagrams

I
n
t
e
r
a
c
t
i
o
n
 
M
o
d
e
l
s
 
(
2
)
:
S
e
q
u
e
n
c
e
 
D
i
a
g
r
a
m
s
E
x
t
r
a
c
t
e
d
 
f
r
o
m
 
t
e
x
t
b
o
o
k
:
O
b
j
e
c
t
 
O
r
i
e
n
t
e
d
 
M
o
d
e
l
i
n
g
 
a
n
d
 
D
e
s
i
g
n
 
w
i
t
h
 
U
M
L
M
.
 
B
l
a
h
a
,
 
J
.
 
R
u
m
b
a
u
g
h
1
Scenarios
A 
scenario is a sequence of events that occurs during
one particular execution of a system, 
such as for a use
case.
A scenario can be displayed as a list of text statements,
as Figure 7.4 illustrates.
The example expresses interaction at a high level. the
details can be shown separately. At early stages of
development, you should express scenarios at a high
level
2
S
c
e
n
a
r
i
o
s
3
S
e
q
u
e
n
c
e
 
D
i
a
g
r
a
m
s
A 
sequence diagram shows 
the participants in an
interaction and the sequence of messages among them.
A sequence diagram shows the interaction of a system
with its actors to perform all or part of a use case.
Figure 7.5 shows a sequence diagram corresponding to
the previous stock broker scenario. Each actor as well as
the system is represented by a vertical line called a
lifeline and 
each message by a horizontal arrow from the
sender to the receiver. Time proceeds from top to
bottom, but the spacing is irrelevant; the diagram shows
only the sequence of messages, not their exact timing.
4
S
e
q
u
e
n
c
e
 
D
i
a
g
r
a
m
s
Note that sequence diagrams can show concurrent
signals
Each use case requires one or more sequence diagrams
to describe its behavior, Each sequence diagram shows
a particular behavior sequence of the use case.
Sequence diagrams can show large-scale interactions,
you can draw a separate sequence diagram for each
task. For example, Figure 7.6 and Figure 7.7 show an
order to purchase a stock and a request for a quote on a
stock.
5
 
6
S
e
q
u
e
n
c
e
 
D
i
a
g
r
a
m
s
7
S
e
q
u
e
n
c
e
 
D
i
a
g
r
a
m
s
You should also prepare a sequence diagram for each exception condition
within the use case. For example, Figure 7.8 shows a variation in which the
customer does not have sufficient funds to place the order. In this example,
the customer cancels the order
8
G
u
i
d
e
 
l
i
n
e
s
 
f
o
r
 
S
e
q
u
e
n
c
e
M
o
d
e
l
s
P
r
e
p
a
r
e
 
a
t
 
l
e
a
s
t
 
o
n
e
 
s
c
e
n
a
r
i
o
 
p
e
r
 
u
s
e
c
a
s
e
.
A
b
s
t
r
a
c
t
 
t
h
e
 
s
c
e
n
a
r
i
o
s
 
i
n
t
o
 
s
e
q
u
e
n
c
e
d
i
a
g
r
a
m
s
.
D
i
v
i
d
e
 
c
o
m
p
l
e
x
 
i
n
t
e
r
a
c
t
i
o
n
s
.
P
r
e
p
a
r
e
 
a
 
s
e
q
u
e
n
c
e
 
d
i
a
g
r
a
m
 
f
o
r
 
e
a
c
h
e
r
r
o
r
 
c
o
n
d
i
t
i
o
n
.
9
I
n
t
e
r
a
c
t
i
o
n
 
M
o
d
e
l
s
 
(
2
)
:
A
c
t
i
v
i
t
y
 
D
i
a
g
r
a
m
s
E
x
t
r
a
c
t
e
d
 
f
r
o
m
 
t
e
x
t
b
o
o
k
:
O
b
j
e
c
t
 
O
r
i
e
n
t
e
d
 
M
o
d
e
l
i
n
g
 
a
n
d
 
D
e
s
i
g
n
 
w
i
t
h
 
U
M
L
M
.
 
B
l
a
h
a
,
 
J
.
 
R
u
m
b
a
u
g
h
10
10
 
An activity diagram shows the sequence of steps that
make up a complex process  such an algorithm or a
workflow.
An activity diagram shows flow of control. It is like a
traditional flowchart in that it shows the flow of control fro
step to step.
However, unlike a traditional flowchart, activity diagrams
can show both sequential and concurrent flow of control.
Activity diagrams are most useful during the early stages
of designing algorithms and workflows.
11
11
A
c
t
i
v
i
t
y
 
(
1
)
The steps of an activity diagrams are operations,
specifically activities from the state model.
The purpose of an activity diagram is to show the steps
within a complex activity and the sequencing constraints
among them.
Some activities run forever until an outside event
interrupt them.
But most activities eventually complete their work and
terminate by themselves. The completion of an activity
indicates that the next activity can be star ted
12
12
A
c
t
i
v
i
t
y
 
(
2
)
An activity may be decomposed into finer activities.
It is important that the activities on an activity diagram be
at the same level of details (level of abstraction).
13
13
14
14
15
15
B
r
a
n
c
h
e
s
 
(
1
)
If there is more than one successor to an activity, ach
arrow ay be modeled with a condition in square brackets,
for example: [failure]
All subsequent conditions are tested when an activity
completes:
If one condition is satisfied its arrow indicates the next activity to
perform.
If no condition is satisfied, the diagram is badly formed and the
system will hang unless it is interrupted at some higher level
If multiple conditions are satisfied , only one successor executes
but no guarantee which one it will be. 
16
16
B
r
a
n
c
h
e
s
 
(
2
)
A diamond shows a branch into multiple successors but
it means the same thing as arrows leaving an activity
symbol directly:
One incoming arrows, two or more outgoing arrows :Decision
node
Several incoming arrows, one outgoing arrow:  Merge node 
17
17
I
n
i
t
i
a
t
i
o
n
/
T
e
r
m
i
n
a
t
i
o
n
Initiation:
 A solid circle with an outgoing arrow shows the starting point
   
of an activity diagram.
When an activity diagram is activated , control starts at the solid
circle and proceeds via the outgoing arrow towards the first
activity.
Termination:
A solid circle surrounded by a hallow circle shows the
termination point.
  
 It only has incoming arrows.
When control reaches this symbol, the overall activity is
complete and execution of the activity diagrams ends.
18
18
C
o
n
c
u
r
r
e
n
t
 
A
c
t
i
v
i
t
i
e
s
Organizations and computer systems can perform more
than one activity at the same time.
Example:  one activity may be followed by another
activity then split into several concurrent activities
  
 (a
fork of control), and finally be combined into a single
activity (a merge control)
A fork or merge is shown by a synchronization bar:
On a synchronization, control must be present on all the
incoming activities, and control passes to all of the outgoing
activities.
19
19
S
p
e
c
i
a
l
 
A
D
 
c
o
n
s
t
r
u
c
t
s
Sending and Receiving signals:
Sometimes  tasks may need to request some
information/signal  from another task or system in
order to pursue their  execution.
ADs support this need through two special constructs:
Sending a signal to request an information
The signal is sent after the preceding activity is completed
Then the next activity is started.
Receiving a signal
When the preceding activity completes, the receipt constructs
waits until the signal is received.
Then the next activity starts.
20
20
21
21
Special AD constructs
Swimlanes:
In a business model it is often useful to know which
human organization is responsible for an activity.
Examples: sales, marketing, purchasing, production,
engineering…
You can show such a partitioning with an activity
diagram by diving it into columns: Each column is
called a swimlane.
Often this kind of AD is called: Role Activity Diagram
22
22
23
23
Slide Note
Embed
Share

Explore scenarios, sequence diagrams, and guidelines for creating effective models in object-oriented design using UML. Learn how to depict interactions, error conditions, and behaviors to enhance system understanding and development efficiency.

  • Object-Oriented
  • Modeling
  • UML
  • Sequence Diagrams
  • Design

Uploaded on Mar 02, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Interaction Models (2): Sequence Diagrams Extracted from textbook: Object Oriented Modeling and Design with UML M. Blaha, J. Rumbaugh 1

  2. Scenarios A scenario is a sequence of events that occurs during one particular execution of a system, such as for a use case. A scenario can be displayed as a list of text statements, as Figure 7.4 illustrates. The example expresses interaction at a high level. the details can be shown separately. At early stages of development, you should express scenarios at a high level 2

  3. Scenarios 3

  4. Sequence Diagrams A sequence diagram shows the participants in an interaction and the sequence of messages among them. A sequence diagram shows the interaction of a system with its actors to perform all or part of a use case. Figure 7.5 shows a sequence diagram corresponding to the previous stock broker scenario. Each actor as well as the system is represented by a vertical line called a lifeline and each message by a horizontal arrow from the sender to the receiver. Time proceeds from top to bottom, but the spacing is irrelevant; the diagram shows only the sequence of messages, not their exact timing. 4

  5. Sequence Diagrams Note that sequence diagrams can show concurrent signals Each use case requires one or more sequence diagrams to describe its behavior, Each sequence diagram shows a particular behavior sequence of the use case. Sequence diagrams can show large-scale interactions, you can draw a separate sequence diagram for each task. For example, Figure 7.6 and Figure 7.7 show an order to purchase a stock and a request for a quote on a stock. 5

  6. 6

  7. Sequence Diagrams 7

  8. Sequence Diagrams You should also prepare a sequence diagram for each exception condition within the use case. For example, Figure 7.8 shows a variation in which the customer does not have sufficient funds to place the order. In this example, the customer cancels the order 8

  9. Guide lines for Sequence Models Prepare at least one scenario per use case. Abstract the scenarios into sequence diagrams. Divide complex interactions. Prepare a sequence diagram for each error condition. 9

  10. Interaction Models (2): Activity Diagrams Extracted from textbook: Object Oriented Modeling and Design with UML M. Blaha, J. Rumbaugh 10

  11. An activity diagram shows the sequence of steps that make up a complex process such an algorithm or a workflow. An activity diagram shows flow of control. It is like a traditional flowchart in that it shows the flow of control fro step to step. However, unlike a traditional flowchart, activity diagrams can show both sequential and concurrent flow of control. Activity diagrams are most useful during the early stages of designing algorithms and workflows. 11

  12. Activity (1) The steps of an activity diagrams are operations, specifically activities from the state model. The purpose of an activity diagram is to show the steps within a complex activity and the sequencing constraints among them. Some activities run forever until an outside event interrupt them. But most activities eventually complete their work and terminate by themselves. The completion of an activity indicates that the next activity can be star ted 12

  13. Activity (2) An activity may be decomposed into finer activities. It is important that the activities on an activity diagram be at the same level of details (level of abstraction). 13

  14. 14

  15. 15

  16. Branches (1) If there is more than one successor to an activity, ach arrow ay be modeled with a condition in square brackets, for example: [failure] All subsequent conditions are tested when an activity completes: If one condition is satisfied its arrow indicates the next activity to perform. If no condition is satisfied, the diagram is badly formed and the system will hang unless it is interrupted at some higher level If multiple conditions are satisfied , only one successor executes but no guarantee which one it will be. 16

  17. Branches (2) A diamond shows a branch into multiple successors but it means the same thing as arrows leaving an activity symbol directly: One incoming arrows, two or more outgoing arrows :Decision node Several incoming arrows, one outgoing arrow: Merge node 17

  18. Initiation/Termination Initiation: A solid circle with an outgoing arrow shows the starting point of an activity diagram. When an activity diagram is activated , control starts at the solid circle and proceeds via the outgoing arrow towards the first activity. Termination: A solid circle surrounded by a hallow circle shows the termination point.It only has incoming arrows. When control reaches this symbol, the overall activity is complete and execution of the activity diagrams ends. 18

  19. Concurrent Activities Organizations and computer systems can perform more than one activity at the same time. Example: one activity may be followed by another activity then split into several concurrent activities(a fork of control), and finally be combined into a single activity (a merge control) A fork or merge is shown by a synchronization bar: On a synchronization, control must be present on all the incoming activities, and control passes to all of the outgoing activities. 19

  20. Special AD constructs Sending and Receiving signals: Sometimes tasks may need to request some information/signal from another task or system in order to pursue their execution. ADs support this need through two special constructs: Sending a signal to request an information The signal is sent after the preceding activity is completed Then the next activity is started. Receiving a signal When the preceding activity completes, the receipt constructs waits until the signal is received. Then the next activity starts. 20

  21. 21

  22. Special AD constructs Swimlanes: In a business model it is often useful to know which human organization is responsible for an activity. Examples: sales, marketing, purchasing, production, engineering You can show such a partitioning with an activity diagram by diving it into columns: Each column is called a swimlane. Often this kind of AD is called: Role Activity Diagram 22

  23. 23

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#