You are on page 1of 6

sohailimran@yahoo.

com

Collaboration Diagram
Ref: Web
Introduction
A collaboration diagram, also known as a communication diagram, is an
illustration of the relationships and interactions among software objects in
the Unified Modeling Language (UML).
These diagrams can be used to portray the dynamic behavior of a particular
use case and define the role of each object.

Collaboration diagrams are created by first identifying the structural


elements required to carry out the functionality of an interaction.
A model is then built using the relationships between those elements.
Several vendors offer software for creating and editing collaboration
diagrams.

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 1


When to use a collaboration diagram
Collaboration diagrams should be used when the relationships among objects are
crucial to display.

A few examples of instances where collaboration diagrams might be helpful include:

• Modeling collaborations, mechanisms or the structural organization within a


system design.
• Providing an overview of collaborating objects within an object-oriented system.
• Exhibiting many alternative scenarios for the same use case.
• Demonstrating forward and reverse engineering.
• Capturing the passage of information between objects.
• Visualizing the complex logic behind an operation.
• However, collaboration diagrams are best suited to the portrayal of simple
interactions among relatively small numbers of objects.
As the number of objects and messages grows, a collaboration diagram can
become difficult to read and use efficiently.
Additionally, collaboration diagrams typically exclude descriptive information, such
as timing.

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 2


Notations of a collaboration diagram
A collaboration diagram resembles a flowchart that portrays the roles, functionality and behavior of
individual objects as well as the overall operation of the system in real time. The four major
components of a collaboration diagram are:
Objects- Objects are shown as rectangles with naming labels inside. The naming label follows the
convention of object name: class name. If an object has a property or state that specifically
influences the collaboration, this should also be noted.
Actors- Actors are instances that invoke the interaction in the diagram. Each actor has a name and a
role, with one actor initiating the entire use case.
Links- Links connect objects with actors and are
depicted using a solid line between two elements.
Each link is an instance where messages can be sent.
Messages- Messages between objects are shown as a
labeled arrow placed near a link.
These messages are communications between objects
that convey information about the activity and can include
the sequence number.

The most important objects are placed in the center of


the diagram, with all other participating objects branching
off. After all objects are placed, links and messages
should be added in between.

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 3


example
• Messages are not shown in time sequence, so numbering becomes essential to indicate the order
of the messages
• Links between objects are explicitly modelled, which is not the case with the sequence diagram
• Messages are grouped together on the object links
• Messages are shown as text labels with an arrow that points from the client (the object sending the
message) to the server (the object providing the response)
• Unlike sequence diagrams, returns are never modelled in a collaboration diagram
• In Figure, the message issueReceipt() is a reflexive message, i.e. a message from :Payment to
itself. A link is modelled from :Payment to itself and the message goes along the link.
On the sequence diagram this is shown as a nested activation.

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 4


collaboration vs sequence diagrams
Collaboration diagrams show pretty much the same information as sequence diagrams.

SEQUENCE DIAGRAMS COLLABORATION DIAGRAMS


The sequence diagram represents the The collaboration diagram also
UML, which is used to visualize the comes under the UML representation
sequence of calls in a system that is which is used to visualize the
used to perform a specific organization of the objects and their
functionality. interaction.
The sequence diagram are used to The collaboration diagram are used
represent the sequence of messages to represent the structural
that are flowing from one object to organization of the system and the
another. messages that are sent and received.
The collaboration dagram is used
The sequence diagram is used when
when object organization is main
time sequence is main focus.
focus.
The collaboration diagrams are better
The sequence diagrams are better suited for depicting simpler
suited of analysis activities. interactions of the smaller number of
objects.

Sohail IMRAN ‫ﺳﻬﯿﻞﻋﻤﺮﺍﻥ‬ 5

You might also like