UML Collaboration Diagram
UML Collaboration Diagram
or
Communication Diagram
Collaboration Diagrams
• Show a particular sequence of messages
exchanged between a number of objects
– this is what sequence diagrams do too!
• Use sequence diagrams to model flows
of control by time ordering
– Better for demonstrating the ordering
of the messages
– Not suitable for complex iteration and
branching
• Use collaboration diagrams to model
flows of control by organization
–Good at showing the static
connections among the objects
while demonstrating a particular
sequence of messages at the same
time
• There is some redundancy between
Collaboration and Sequence
Diagrams.
• They differently show how
elements interact over time
• Collaboration Diagrams show
relationship between objects.
• Sequence Diagrams focus on
the time in which events occur.
• Each message in a collaboration
diagram has a sequence number.
• The top-level message is
numbered 1. Messages sent
during the same call have the
same decimal prefix but suffixes
of 1, 2, etc. according to when
they occur.
What is a Collaboration?
• A Collaboration is a collection
of named objects and actors
with links connecting them.
They collaborate in performing
some task.
Collaborations
• Actors
Each Actor is named and has a
role
One actor will be the initiator of
the use case
Collaborations
• Objects
Each object in the collaboration is
named and has its class specified
Not all classes need to appear
There may be more than one
object of a class
• Objects – rectangles containing the object
signature – object signature:
object name : object Class
• object name (optional) - starts
with lowercase letter
• class name (mandatory) - starts
with uppercase letter
Collaborations
• Links
Links connect objects and actors
and are instances of associations
Each link corresponds to an
association in the class diagram
Messages
• Message Signature
return-value, message-name and argument-list
Types of Messages
Simple
• Indicates flow of control - sender waits until
receiver processes message (Default).
Synchronous
• A message is sent by one object to another and
the first object waits until the resulting action has
completed.
Asynchronous
• A message is sent by one object to another , but
the first object does not wait until the resulting
action has completed.