|
Collaboration Diagrams
A distinguishing feature of a Collaboration diagram is that it shows the objects and their association with other objects in the system apart from how they interact with each other. The association between objects is not represented in a Sequence diagram.
A Collaboration diagram consists of the following elements:
Object: The objects interacting with each other in the
system. Depicted by a rectangle with the name of the object in
it, preceded by a colon and underlined.
Links/Association: The connecting lines drawn between
objects in a collaboration diagram are links. These links are
what set collaboration diagrams apart from 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 between objects represent messages sent from one
object to another
A link is assumed to represent an association between
objects. However, following adornments for links to
indicate how objects are associated:
- Global (the object is visible as a global variable)
- Local (the object is visible as a local variable)
- Parameters (the object is visible as a parameter)
- Self (represents the ability of an object to send a
message to itself)
Messages: An arrow pointing from the commencing object to
the destination object shows the interaction between the
objects. The number represents the order/sequence of this
interaction
The numbers next to the messages are called sequence numbers.
As the name suggests, they show the sequence of the messages
as they are passed between the objects. There are many
acceptable sequence numbering schemes in UML. A simple 1, 2,
3... format can be used, as the example below shows.
Collaboration diagrams have
a distinct advantage over sequence diagrams in that they allow
you to show more complex branching as well as multiple
concurrent flows of control. In contrast, the format and
nature of sequence diagrams really only allow you to show
simple branching
|