Lab 07 (Interaction Diagram)
Lab 07 (Interaction Diagram)
Interaction diagram:
From the term Interaction, it is clear that the diagram is used to describe some type of
interactions among the different elements in the model. This interaction is a part of dynamic
behavior of the system.
This interactive behavior is represented in UML by two diagrams known as Sequence diagram
and Collaboration diagram. The basic purpose of both the diagrams is similar.
Sequence diagram emphasizes on time sequence of messages and collaboration diagram
emphasizes on the structural organization of the objects that send and receive messages.
The purpose of interaction diagrams is to visualize the interactive behavior of the system.
Types of Interaction Diagrams:
Sequence diagram
Communication Diagram
Sequence Diagram:
Sequence diagram is the most common kind of interaction diagram, which focuses on the
message interchange between a numbers of lifelines.
Sequence diagram describes an interaction by focusing on the sequence of messages that
are exchanged, along with their corresponding occurrence specifications on the lifelines.
The following nodes and edges are typically drawn in a UML sequence diagram:
– Lifeline, execution specification, message, combined fragment, interaction use,
state invariant continuation destruction occurrence.
Example:
The sequence diagram has four objects (Customer, Order, SpecialOrder and NormalOrder).
The following diagram shows the message sequence for SpecialOrder object and the same can
be used in case of NormalOrder object. It is important to understand the time sequence of
message flows. The message flow is nothing but a method call of an object.
The first call is sendOrder () which is a method of Order object. The next call is confirm
() which is a method of SpecialOrder object and the last call is Dispatch () which is a method
of SpecialOrder object. The following diagram mainly describes the method calls from one
object to another, and this is also the actual scenario when the system is running.
Communication Diagram:
Communication diagram (called collaboration diagram in UML 1.x) is an interaction
diagram which shows interactions between Objects and/or parts (represented as lifelines)
using sequenced messages in a free-form arrangement.
Communication diagram corresponds (could be converted to/from or replaced by) to
simple sequence diagram.
Example:
Collaboration diagram shows the object organization as seen in the following diagram. In the
collaboration diagram, the method call sequence is indicated by some numbering technique. The
number indicates how the methods are called one after another. We have taken the same order
management system to describe the collaboration diagram.
Method calls are similar to that of a sequence diagram. However, difference being the sequence
diagram does not describe the object organization, whereas the collaboration diagram shows the
object organization.
To choose between these two diagrams, emphasis is placed on the type of requirement. If the
time sequence is important, then the sequence diagram is used. If organization is required, then
collaboration diagram is used.
Question No 1: