0% found this document useful (0 votes)
55 views27 pages

Interaction Diagrams: Unit 3-2

The document discusses interaction diagrams in UML, including sequence diagrams and collaboration diagrams. Sequence diagrams emphasize time ordering of messages while collaboration diagrams emphasize structural organization. Both can be used to model flows of control through time ordering or organization of objects. Forward and reverse engineering is possible with interaction diagrams.

Uploaded by

rams ramlee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views27 pages

Interaction Diagrams: Unit 3-2

The document discusses interaction diagrams in UML, including sequence diagrams and collaboration diagrams. Sequence diagrams emphasize time ordering of messages while collaboration diagrams emphasize structural organization. Both can be used to model flows of control through time ordering or organization of objects. Forward and reverse engineering is possible with interaction diagrams.

Uploaded by

rams ramlee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Interaction Diagrams

Unit 3-2

04/07/2020 "UML User Guide" Grady Booch 1


Contents
• Introduction
• Sequence Diagram
• Collaboration Diagram
• Modeling flows of control by time ordering
• Modeling flows of control by organization
• Forward and reverse engineering

04/07/2020 "UML User Guide" Grady Booch 2


Introduction
• Interaction diagrams to model the dynamic
aspects of a system
• Interaction Diagrams
1.Sequence Diagram
2.Collaboration Diagram

04/07/2020 "UML User Guide" Grady Booch 3


Introduction
• A sequence diagram is an interaction diagram
that emphasizes the time ordering of messages
• A collaboration diagram is an interaction
diagram that emphasizes the structural
organization of the objects that send and
receive messages

04/07/2020 "UML User Guide" Grady Booch 4


Introduction

Sequence Diagram

04/07/2020 "UML User Guide" Grady Booch 5


Introduction
• “destroy” event message Specifies that the
target object is destroyed by the event or the
message
• “create” event message Specifies that the
target object is created by the event or the
message

04/07/2020 "UML User Guide" Grady Booch 6


Introduction

Collaboration Diagram

04/07/2020 "UML User Guide" Grady Booch 7


Sequence Diagram
• Parts of Interaction Diagram
-Objects
-Links
-Messages

04/07/2020 "UML User Guide" Grady Booch 8


Sequence Diagram
• A sequence diagram emphasizes the time ordering of
messages.
• Form a sequence diagram by first placing the objects
that participate in the interaction at the top of the
diagram, across the X axis.
• Place the object that initiates the interaction at the left,
and increasingly more subordinate objects to the right.
• Next,place the messages that these objects send and
receive along the Y axis, in order of increasing time
from top to bottom.
04/07/2020 "UML User Guide" Grady Booch 9
Sequence Diagram
• Object lifeline
-An object lifeline is the vertical dashed line that
represents the existence of an object over a period of
time.
• Focus of control
-The focus of control is a tall, thin rectangle that shows
the period of time during which an object is performing
an action.
-The top of the rectangle is aligned with the start of
the action; the bottom is aligned with its completion
04/07/2020 "UML User Guide" Grady Booch 10
Sequence Diagram

04/07/2020 "UML User Guide" Grady Booch 11


Collaboration Diagram
• Path
-To indicate how one object is linked to another, you can
attach a path
• Sequence number
-To indicate the time order of a message, prefix the
message with a number (starting with the message numbered
1), increasing monotonically for each new message in the flow
of control (2, 3, and so on).
-To show nesting, use decimal numbering (1 is the first
message; 1.1 is the first message nested in message 1; 1.2 is
the second message nested in message 1; and so on).

04/07/2020 "UML User Guide" Grady Booch 12


Collaboration Diagram

04/07/2020 "UML User Guide" Grady Booch 13


Collaboration Diagram
• “transient” instance link Specifies that the instance
or link is created during execution of the
enclosing interaction but is destroyed before
completion of execution
• “local” link end Specifies that the corresponding
object is visible because it is in a local scope
• “global” link end Specifies that the corresponding
object is visible because it is in an enclosing scope

04/07/2020 "UML User Guide" Grady Booch 14


Sequence Vs Collaboration diagram

• Sequence diagrams and collaboration


diagrams are semantically equivalent.
• We can take a diagram in one form and
convert it to the other without any loss of
information

04/07/2020 "UML User Guide" Grady Booch 15


Sequence Vs Collaboration diagram

• The sequence diagram shows message return


(note the return value committed), but the
Corresponding collaboration diagram does not
• The collaboration diagram shows how the
objects are linked whereas the corresponding
sequence diagram does not

04/07/2020 "UML User Guide" Grady Booch 16


Modeling Flows of Control by Time Ordering

1. To model flows of control by time ordering


2. To model flows of control by organization

04/07/2020 "UML User Guide" Grady Booch 17


Modeling Flows of Control by Time Ordering

To model a flow of control by time ordering


• Set the context for the interaction, whether it is a system, subsystem,
operation, or class, or one scenario of a use case or collaboration.
• Set the stage for the interaction by identifying which objects play a role
in the interaction.
• Lay them out on the sequence diagram from left to right, placing the
more important objects to the left and their neighboring objects to the
right.
• Set the lifeline for each object. In most cases, objects will persist through
the entire interaction. For those objects that are created and destroyed
during the interaction.
• Set their lifelines, as appropriate, and explicitly indicate their birth and
death with appropriately stereotyped messages.

04/07/2020 "UML User Guide" Grady Booch 18


Modeling Flows of Control by Time Ordering

• Starting with the message that initiates this interaction, lay out
each subsequent message from top to bottom between the lifelines,
showing each message's properties (such as its parameters), as
necessary to explain the semantics of the interaction.
• If you need to visualize the nesting of messages or the points in
time when actual computation is taking place, adorn each object's
lifeline with its focus of control.
• If you need to specify time or space constraints, adorn each
message with a timing mark and attach suitable time or space
constraints.
• If you need to specify this flow of control more formally, attach
pre- and postconditions to each message.

04/07/2020 "UML User Guide" Grady Booch 19


Modeling Flows of Control by Time Ordering

04/07/2020 "UML User Guide" Grady Booch 20


Modeling Flows of Control by Organization
• Set the context for the interaction, whether it is a system, subsystem,
operation, or class, or one scenario of a use case or collaboration.
• Set the stage for the interaction by identifying which objects play a role
in the interaction.
• Lay them out on the collaboration diagram as vertices in a graph,
placing the more important objects in the center of the diagram and their
neighboring objects to the outside.
• Set the initial properties of each of these objects. If the attribute values,
tagged values, state, or role of any object changes in significant ways
over the duration of the interaction, place a duplicate object on the
diagram, update it with these new values
connect them by a message stereotyped as become or copy (with a
suitable sequence number).

04/07/2020 "UML User Guide" Grady Booch 21


Modeling Flows of Control by Organization
• Specify the links among these objects, along which messages may pass.
1. Lay out the association links first; these are the most important ones,
because they represent structural connections.
2. Lay out other links next, and adorn them with suitable path
stereotypes (such as global and local) to explicitly specify how these
objects are related to one another.
• Starting with the message that initiates this interaction, attach each
subsequent message to the appropriate link, setting its sequence number,
as appropriate. show nesting by using Dewey decimal numbering.
• If you need to specify time or space constraints, adorn each message with
a timing mark and attach suitable time or space constraints.
• If you need to specify this flow of control more formally, attach pre- and
post conditions to each message.

04/07/2020 "UML User Guide" Grady Booch 22


Modeling Flows of Control by Organization

• “become” message Specifies that the target is


the same object as the source but at a later
point in time and with possibly different
values, state, or roles
• “copy” message Specifies that the target
object is an exact but independent copy of the
source

04/07/2020 "UML User Guide" Grady Booch 23


Modeling Flows of Control by Organization

04/07/2020 "UML User Guide" Grady Booch 24


Forward and Reverse Engineering
• Forward engineering possible for both
sequence and collaboration diagrams.

04/07/2020 "UML User Guide" Grady Booch 25


Forward and Reverse Engineering
public void register()
{
CourseCollection c = getSchedule();
for (int i = 0; i < c.size(); i++)
c.item(i).add(this);
this.registered = true;
}

04/07/2020 "UML User Guide" Grady Booch 26


Forward and Reverse Engineering
• The tool would have to realize that
getSchedule returns a courseCollection object,
which it could determine by looking at the
operation's signature.
• Reverse engineering (the creation of a model
from code) is also possible for both sequence
and collaboration diagrams, especially if the
context of the code is the body of an operation.

04/07/2020 "UML User Guide" Grady Booch 27

You might also like