AssociationEndRole Message
Part 8 - Collaboration Diagrams 3.65 Collaboration Diagram
3.66 Pattern Structure
3.66.1 Semantics
A Collaboration can be used to specify the implementation of design constructs. For this purpose, it is necessary to specify its context and interactions. It is also possible to view a Collaboration as a single entity from the “outside.” For example, this could be used to identify the presence of design patterns within a system design. A pattern is a parameterized Collaboration; that is, a Collaboration template. In each use of the pattern, actual Classifiers are substituted for the parameters in the pattern definition.
Note that patterns as defined in Design Patterns by Gamma, Helm, Johnson, and Vlissides include much more than structural descriptions. UML describes the structural aspects and some behavioral aspects of design patterns; however, UML notation does not include other important aspects of patterns, such as usage trade-offs or examples.
These must be expressed by other means, such as in text or tables.
tutor / Teacher : Person
/ Student : Person
1: namesOfTeachers() studentTeachers ()
1.1*[i:=1..n]: lecturer()
: Course
1.i.1: name () lecturer / Teacher : Person
September 2001 OMG-UML , v1.4 Pattern Structure 3-119 A Collaboration can be defined in terms of other, so-called subordinate,
Collaborations. Each role in the former Collaboration, the so-called superordinate Collaboration, is either a new role that is defined in the superordinate Collaboration or it is a role defined in one or several of the subordinate Collaborations and reused in the definition of the superordinate Collaboration. In the latter case, the role is often renamed so it better suits the purpose of the superordinate Collaboration. If so, the original names of the roles are shown within curly brackets after the name used within the superordinate Collaboration (see Figure 3-66 on page 3-121).
3.66.2 Notation
A use of a Collaboration is shown as a dashed ellipse containing the name of the Collaboration. A dashed line is drawn from the collaboration symbol to each of the symbols denoting Classifiers that participate in the Collaboration. Each line is labeled by the role of the participant. The roles correspond to the names of elements within the context for the Collaboration; such names in the Collaboration are treated as
parameters that are bound to specify elements on each occurrence of the pattern within a model. Therefore, a collaboration symbol can show the use of a design pattern together with the actual Classifiers and Associations that occur in that particular use of the pattern.
Figure 3-62 Use of a Collaboration.
As a Collaboration is a GeneralizableElement, it may have Generalization relationships to other Collaborations. In this way it is possible to define one Collaboration to be a specialization of another Collaboration. It is depicted by the ordinary Generalization arrow from the dashed ellipse representing the child Collaboration to the icon of the parent Collaboration. The roles of the child Collaborations may be specializations of roles in the parent Collaboration. This is shown by redefining the role name of the parent collaboration in the child collaboration.
Observer
Observer.range = (0 .. Subject.capacity)
Figure 3-63 Specialization of a Collaboration. As the Subject role of the Supervisor collaboration is a specialization (an extension) of the Subject role defined in the Observer collaboration, the ManagedQueue class is used instead of the CallQueue class as the base of the Subject role.
A dashed arrow with a stick arrowhead is used to show that a Collaboration is a realization of an Operation or a Classifier. This relationship can also be presented in textual form within the Collaboration symbol.
Figure 3-64 The relationship between a Collaboration and the element it is realizing can be shown either as a dashed arrow with a stick arrowhead from the Collaboration to the realized element, or in text.
The usual convention is used to show a CollaborationInstanceSet; that is, it is shown as a dashed ellipse with the name underlined. The Instances and the Links that participate in the CollaborationInstanceSet are connected to the ellipse with dashed lines. The name of the role an instance is playing is shown close to the line and the instance.
In some cases it is convenient to show the static structure of a Collaboration within the collaboration icon (the dashed ellipse).
Observer SlidingBarIcon
Observer CallQueue
Subject
Supervisor Controller
Manager ManagedQueue
Subject
Window display (...)
representedOperation:
alternative notation Window:: display
RealizeDisplayOperation
RealizeDisplayOperation
September 2001 OMG-UML , v1.4 Pattern Structure 3-121 Figure 3-65 The static structure of a Collaboration shown within the collaboration icon.
It is possible to denote that a Collaboration is defined in terms of other Collaborations in two different ways, either using dashed ellipses showing the Collaborations and their relationships, or using ordinary collaboration diagrams. The former way has the advantage that it explicitly shows the relationship between the Collaborations, while the latter shows the structure of the new Collaboration.
Figure 3-66 The ComponentFramework Collaboration uses two occurrences of the Proxy Collaboration and two occurrences of the Container Collaboration. Note that each role in the Component Framework corresponds to a role in two of the used Collaborations.
3.66.3 Mapping
A collaboration usage symbol maps into a Collaboration. For each class symbol and lines attached by a dashed line to the pattern occurrence symbol, the corresponding Classifier or Association is bound to the template parameter that is the base association target of the ClassifierRole or AssociationRole in the Collaboration template with the name equal to the name on the dashed line.
A dashed arrow with a closed hollow arrowhead from a Collaboration symbol to a Classifier or to an Operation is mapped onto the representedClassifier and onto the representedOperation association of the Collaboration, respectively.
A collaboration usage symbol with its name underlined is mapped onto a
CollaborationInstanceSet. The object box symbols and the lines attached to the ellipse by dashed lines are mapped onto Instances and Links, respectively.