Lec 8 SREE

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 24

SE-4283

Software Re-Engineering

Lecture: 08
Sequence [Todays Agenda]
Content of Lecture
•Sequence Diagram
•Collaboration Diagram
Types of Interaction diagrams

There are two types of interaction diagrams:


1. Sequence diagrams:
Emphasize the order / Sequence or
concurrency of the interactions.
2. Collaboration diagrams:
Emphasize the interacting objects.
Scenarios
Use case diagram presents an outside view
of the system.
Flow of events, captures the functionality of
the use case.
Scenarios are used to describe how use
cases are realized as interactions among
societies of objects.
Scenarios
It is one path through the flow of events for the use
case.
Scenarios help discovering objects, classes and
object interaction needed to carry out a piece of the
functionality in use case
Scenarios shows how the responsibility of a use
case are distributed among the objects
Scenarios how to capture?

1. Sequence Diagram
2. Collaboration Diagram
Sequence Diagram (make a phone
call)
:Caller :Phone :Recipient

Picks up()

Dial tone()

Dial () Ring(
)
Ring notification ()
Picks up()

Hello() Hello()
Representing
Objects
Squares with object type, optionally preceded by
"name :"
–write object's name if it clarifies the diagram
–object's "life line" represented by dashed vert. line
Messages Between
Objects
messages (method calls) indicated by arrow
to other object
– write message name and arguments above
arrow
Lifetime of
creation: objects
arrow with 'new'
written above it
–notice that an object created
after the start of the scenario
appears lower than the others

deletion: an X at bottom of
object's lifeline
–Java doesn't explicitly delete
objects; they fall out of scope
and are garbage-collected
Selection and
frame: box around part of
loops
diagram to indicate if or loop
– if ->
[condition] (opt)
– if/else -> (alt)
[condition], separated
by horizontal dashed
line
– loop -> (loop)
[condition or items to
loop over]
Sequence diagram from use case
scenario
Collaboration
Diagram

1
Collaboration Diagrams
• Dynamic behavior of objects can, in addition to
sequence diagrams, also be represented by
collaboration diagrams.
• The transformation from a sequence diagram into
a collaboration diagram is a bi-directional function.
• The difference between sequence diagrams and
collaboration diagrams is that collaboration
diagrams emphasize more the structure than the
sequence of interactions.
• Within sequence diagrams the order of
interactions is established by vertical positioning
whereas in collaboration diagrams the sequence
is given by numbering the interactions.
14
Sequence Diagram (Example)
Collaboration Diagrams

16
Fun Example Sequence
diagram

18
Fun Example Sequence
diagram

19
Fun Example Collaboration
diagram

20
When to use Interaction Diagrams

21
Class Activity
Class Activity
24

You might also like