Previous | UML Classes | Table of Contents | UML Packages | Next |
A collaboration describes a structure of collaborating elements (roles), each performing a specialized function, which collectively
accomplish some desired functionality. Its primary purpose is to explain how a system works and, therefore, it typically only
incorporates those aspects of reality that are deemed relevant to the explanation. Thus, details, such as the identity or
precise class of the actual participating instances are suppressed.
•
BehavioredClassifier (from BasicBehaviors , Communications ) on page 451
•
StructuredClassifier (from InternalStructures ) on page 193
A collaboration is represented as a kind of classifier and defines a set of cooperating entities to be played by instances
(its roles), as well as a set of connectors that define communication paths between the participating instances. The
cooperating entities are the properties of the collaboration (see Property (from InternalStructures ) on page 190).
A collaboration specifies a view (or projection) of a set of cooperating classifiers. It describes the required links between
instances that play the roles of the collaboration, as well as the features required of the classifiers that specify the participating
instances. Several collaborations may describe different projections of the same set of classifiers.
No additional attributes
collaborationRole: ConnectableElement [*] | References connectable elements (possibly owned by other classifiers), which represent roles that instances may play in this collaboration. (Subsets StructuredClassifier .role) |
No additional constraints
Collaborations are generally used to explain how a collection of cooperating instances achieve a joint task or set of tasks.
Therefore, a collaboration typically incorporates only those aspects that are necessary for its explanation and suppresses
everything else. Thus, a given object may be simultaneously playing roles in multiple different collaborations, but each collaboration
would only represent those aspects of that object that are relevant to its purpose.
A collaboration defines a set of cooperating participants that are needed for a given task. The roles of a collaboration will
be played by instances when interacting with each other. Their relationships relevant for the given task are shown as connectors
between the roles. Roles of collaborations define a usage of instances, while the classifiers typing these roles specify all
required properties of these instances. Thus, a collaboration specifies what properties instances must have to be able to
participate in the collaboration. A role specifies (through its type) the required set of features a participating instance
must have. The connectors between the roles specify what communication paths must exist between the participating instances.
Neither all features nor all contents of the participating instances nor all links between these instances are always required
in a particular collaboration. Therefore, a collaboration is often defined in terms of roles typed by interfaces (see
Interface (from Interfaces ) on page 87). An interface is a description of a set of properties (externally observable
features) required or provided by an instance. An interface can be viewed as a projection of the externally observable features
of a classifier realizing the interface. Instances of different classifiers can play a role defined by a given interface,
as long as these classifiers realize the interface (i.e., have all the required properties). Several interfaces may be realized
by the same classifier, even in the same context, but their features may be different subsets of the features of the realizing
classifier.
Collaborations may be specialized from other collaborations. If a role is extended in the specialization, the type of a role
in the specialized collaboration must conform to the type of the role in the general collaboration. The specialization of
the types of the roles does not imply corresponding specialization of the classifiers that realize those roles. It is sufficient
that they conform to the constraints defined by those roles.
A collaboration may be attached to an operation or a classifier through a CollaborationUse . A collaboration used in this way
describes how this operation or this classifier is realized by a set of cooperating instances. The connectors defined within
the collaboration specify links between the instances when they perform the behavior specified in the classifier. The collaboration
specifies the context in which behavior is performed. Such a collaboration may constrain the set of valid interactions that
may occur between the instances that are connected by a link.
A collaboration is not directly instantiable. Instead, the cooperation defined by the collaboration comes about as a consequence
of the actual cooperation between the instances that play the roles defined in the collaboration (the collaboration is a selective
view of that situation).
A collaboration is shown as a dashed ellipse icon containing the name of the collaboration. The internal structure of a collaboration
as comprised by roles and connectors may be shown in a compartment within the dashed ellipse icon. Alternatively, a composite
structure diagram can be used.
Observer
Using an alternative notation for properties, a line may be drawn from the collaboration icon to each of the symbols denoting
classifiers that are the types of properties of the collaboration. Each line is labeled by the name of the property. In this
manner, a collaboration icon can show the use of a collaboration together with the actual classifiers that occur in
that particular use of the collaboration (see Figure 9.12).
CallQueue
queue: List of Call source: Object waitAlarm: Alarm capacity: Integer
Subject
Observer
Observer
SlidingBarIcon
reading: Real color: Color range: Interval
The primary purpose of collaborations is to explain how a system of communicating entities collectively accomplish a specific
task or set of tasks without necessarily having to incorporate detail that is irrelevant to the explanation. It is particularly
useful as a means for capturing standard design patterns.
The contents of a collaboration is specified as its internal structure relying on roles and connectors; the concepts of ClassifierRole,
AssociationRole, and AssociationEndRole have been superseded. A collaboration in UML 2.0 is a kind of classifier, and can
have any kind of behavioral descriptions associated. There is no loss in modeling capabilities.