Many model elements present an 'type/instance' dichotomy, in which a type represents the essence of an abstraction, and the instance forms a concrete sample. There is also a 'type/class' dichotomy, in which classes and primitive types implement types.
A type specifies a domain of values and a set of operations applicable to those values. A class implements a type: it provides the representation of attributes and the implementation of operations (methods). This distinction is propagated with subclasses, so that the specification given for a type is valid for all subclasses, and a subclass may implement several types.
The class diagram below represents both the type/instance dichotomy and the type/class dichotomy.
Simplified metamodel — an instance expresses a type; a class implements a type.
The
class includes the following subclasses:Type
The following diagram represents the different kinds of types proposed by UML:
Simplified metamodel — representation of different kinds of types.
The
class comprises the following subclasses:Class
Simplified metamodel — representation of the various kinds of classes.
UML defines five kinds of relationships. The most general is called a dependency relationship and applies uniformly to all the model elements. Association and generalization apply to all types, in particular classes and use cases. The last two relationships — transitions and links — apply to certain model elements pertaining to behavior.
This section is limited to the description of static relationships between classes, shown in the diagram below. Links and transitions are discussed later on in this chapter.
Simplified metamodel—representation of relationships between classes.
An association specifies a bi-directional, semantic connection between types. An association has at least two roles, which describe the part played by the types that participate in the association.
Simplified metamodel—representation of the main characteristics of associations.
Each role comprises the following attributes:
True
. If the multiplicity is larger than 1
, several instances play the role of the whole and share the parts.An association role may also include a set of attributes whose values implement a partition of the set of objects of the associated class.
Generalization specifies a classification relationship in which an instance of a subtype may be substituted for an instance of a supertype. A supertype may have several subtypes, and a subtype may have several supertypes.
Simplified metamodel—representation of the generalization relationship and of elements prone to generalization.
Any element that may be generalized includes the following Boolean attributes:
True
specifies that the element cannot be instantiated directlyTrue
specifies that the element may not have subtypesTrue
specifies that the element may not have supertypesUML defines three kinds of generalizable elements:
Dependency is a unidirectional usage relationship between elements (both model and visual). The dependency relationship connects elements within the same model.
Simplified metamodel—representation of dependency relationships
UML also provides a 'trace' relationship between elements that belong to different models. Notably, the trace may be used to represent the history of current constructions in various models. This trace relationship is a stereotyped dependency relationship.
Simplified metamodel—the trace relationship is a stereotyped dependency relationship.
© 1997 Editions, Eyrolles, Paris, France . All rights reserved.