Sunteți pe pagina 1din 31

Unified Modeling

Language ( UML ) 
Communication Diagrams( Or
Collaboration Diagrams)
What is a Communication Diagram
Communication diagram (called

Collaboration diagram in UML 1.x)

A kind of UML interaction diagram which


shows interactions between objects


and/or parts (represented as lifelines) using
sequenced messages in a free-form 2

arrangement
What is a Collaboration
•A Collaboration is a collection of named objects
and actors with links connecting them as they
collaborate in performing some task
•A Collaboration defines a set of participants and

relationships that are meaningful for a given set


of purposes
•Objects collaborate by communicating (passing

messages) with one another in order to work 3


together
Collaboration( or Communication )
Diagrams : Purpose
•Model collaborations between objects or roles that deliver
the functionalities of use cases and operations
•Model mechanisms within the architectural design of the

system
•Capture interactions that show the passed messages

between objects and roles within the collaboration


•Model alternative scenarios within use cases or operations

that involve the collaboration of different objects and


interactions
4
•Support the identification of objects (hence classes) that
Collaboration Diagram : An Example

5
Why Use Collaboration Diagram when
opposed to Sequence Diagrams
▪ First of all, they are very useful for visualizing the relationship
between objects collaborating to perform a particular task
which is difficult to determine from a sequence diagram
▪ In addition, collaboration diagrams can also help us determine
the accuracy of our static model (i.e., class diagrams)
▪ Some developers take the step of creating static models of
their business objects, but don't "prove" their models by
creating associated dynamic models
▪ Once we put our classes into action (or interaction), we can
often see flaws in our static model that may not have been 6

discovered otherwise
Sequence Diagrams Vs Collaboration
Diagrams
•Sequence and collaboration diagrams
both aim at describing the dynamic
interactions between objects and the
information we can describe is basically
the same, but the two models have a
different focus
7
Sequence Diagrams Vs
Collaboration Diagrams
•Sequence diagrams highlight more the temporal aspect, by
showing invocation and responses along a (vertical) timeline
and by explicitly showing the activation time of objects
•Sequence diagrams show how objects communicate with

each other in terms of a temporal sequence of messages


•The time flow is the most visible aspect in these diagrams, as

messages are sequenced according to a vertical timeline and


also the lifespan of objects associated to those messages is
reported 8
Sequence Diagrams Vs
Collaboration Diagrams

9
Sequence Diagrams Vs
Collaboration Diagrams
•Collaboration diagrams aim at showing the
communications that happen between objects,
by defining messages that flow between each
other
•They basically consist of superimposing the

communication actions upon an object diagram


and the temporal aspect can be shown here too,
10
by numbering the interactions with sequential
Sequence Diagrams Vs
Collaboration Diagrams
•A collaboration diagram shows the interactions
between objects or classes in terms of links
(solid undirected lines connecting the elements
that can interact) and messages that flow
through the links
•This describes at the same time some kind of

static structure (links and nodes) and dynamic


11
behavior (messages) of the system
Sequence Diagrams Vs
Collaboration Diagrams

12
13
14
Steps for Creating Collaboration
Diagrams
▪ Identify behavior whose realization and implementation is specified
▪ Identify the structural elements (class roles, objects, subsystems)
necessary to carry out the functionality of the collaboration
▫ Decide on the context of interaction: system, subsystem, use
case and operation
▪ Model structural relationships between those elements to produce a
diagram showing the context of the interaction
▪ Consider the alternative scenarios that may be required
▫ Draw instance level collaboration diagrams, if required.
▫ Optionally draw a specification level collaboration diagram to
summarize the alternative scenarios in the instance level 15

sequence diagrams
Communication Diagram:
Basic Notations

16
Objects
•Objects participating in a collaboration
come in two flavors : supplier and client
•Supplier objects are the objects that

supply the method that is being called, and


therefore receive the message
•Client objects call methods on supplier
17

objects, and therefore send messages


In this Figure, the Transaction object acts as a Supplier
to the UI (User Interface) Client object. In turn, the Fine
18
object is a Supplier to the Transaction Client object.
Links
•The connecting lines drawn between objects in a collaboration
diagram are links and are distinct features of collaboration
diagrams contrast to sequence diagrams
•They enable us to see the relationships between objects

•Each link represents a relationship between objects and symbolizes

the ability of objects to send messages to each other


•A single link can support one or more messages sent between

objects
•This is different from sequence diagrams, where the lines drawn
19
between objects represent messages sent from one object to
another
As you can see by looking at Figure 2, the visual representation of a link is a straight
line between two objects. If an object sends messages to itself, the link carrying these
messages is represented as a loop icon. This loop can be seen on both the UI object 20
and the Transaction object.
Links( contd…)
•Links in a collaboration diagram directly correlate
to associations between classes in a class diagram
•For example, an association between the

Transaction object and Fine object as seen on a


class diagram can be seen as a corresponding link
between the two objects
•The association in the class diagram translates into
21
a link in a collaboration diagram
Associations specified in a class diagram can be
represented as links in a collaboration diagram

22
23
Case Scenario : Local software
Update
•Communication diagram for a software update
process having three objects – Software Update,
Local Update and Install
•Software update object gets triggered when there is

a need for update


•Software update then checks for any local update is

available
If local updates are available Install object instance is
24
created and update is installed
25
In a NUTSHELL
Communication diagram are used to
represent links between objects
They help us to understand how objects
interact with each other in a System

26
Case Scenario : Login Process of
Student Management System
▪ The flow of communication required is given by,
▪ A student requests a login through the login
system
▪ An authentication mechanism of software
checks the request
▪ If a student entry exists in the database, then
the access is allowed; otherwise, an error is 27
returned
28
Benefits of a Collaboration Diagram
▪ It emphasizes the structural aspects of an interaction diagram - how
lifeline connects and has a syntax similar to that of sequence diagram
except that lifeline don't have tails
▪ Messages passed over sequencing is indicated by numbering each
message hierarchically and as compared to the sequence diagram
communication diagram is semantically weak
▪ Object diagrams are special case of communication diagram
▪ It allows us to focus on the elements rather than focusing on the
message flow as described in the sequence diagram
▪ Sequence diagrams can be easily converted into a collaboration
diagram as collaboration diagrams are not very expressive
29
▪ While modeling collaboration diagrams with respect to sequence
diagrams, some information may be lost
Drawbacks of a Collaboration Diagram
▪ Collaboration diagrams can become complex when
too many objects are present within the system.
▪ It is hard to explore each object inside the system.
▪ Collaboration diagrams are time consuming.
▪ The object is destroyed after the termination of a
program.
▪ The state of an object changes momentarily, which
makes it difficult to keep track of every single 30
change the occurs within an object of a system.
THANK YOU

S-ar putea să vă placă și