Common Mechanisms
The four common mechanisms that apply throughout UML are:
Specifications
Adornments
Common Divisions
Extensibility Mechanisms
|
Here, the use of adornments and extensibility mechanisms are discussed
- Node is an important adornment
- Extensibility mechanisms are used to extend the language in controlled ways
- These mechanisms contain stereotypes, tagged values and constraints
Node
Stereotype
Tagged Value
Constraint
|
Node
- Used for adding constraints or comments to an element/group of elements
- Use to attach information to a model such as observations, requirements and explanations
- Has no semantic impact, i.e., its content does not change the meaning of the model to which it is attached
- Graphically represented as rectangle with a dog-eared corner
Stereotype
- Used to extend the vocabulary of the UML by creating new model elements derived from existing ones that have specific properties suitable for a domain/problem
- Each stereotype defines a set of properties that are received by elements of that stereotype
- Graphically represented as a name enclosed by guillemots and placed above the name of another element («name»)
Tagged Value
- Extend the properties of a UML building block by allowing to create new information in that element's specification
- Can be defined for existing elements of the UML
- Can also define tags that apply to individual stereotypes. Then everything within that stereotype will have that tagged value
- A tagged value is a kind of metadata, since its value applies to the element itself and not its instances
- Graphically represented as a string enclosed by brackets and placed below the name of another element
Constraint
- Extend the semantics of a UML building block that allows to add new rules, or modify existing ones
- Graphically represented as a string enclosed by brackets and placed near the associated elements or connected to that elements by dependency relationships
Modeling New Properties
- To model new properties:
- To model new properties, If there is no way to express what is needed by using UML and if there is no other way to describe the semantics, define a stereotype and assign the new properties to it
- The rules of generalization are applied
- The tagged values, which are defined for a kind of stereotype, apply to its children too
Modeling New Semantics
To model new semantics:
- If there is no way to express what is needed by using UML, and
- If there is no way to convey the semantics, write new semantics in a constraint and place it near the element to which it refers
- Depict a more precise relationship by connecting a constraint to its elements by using a dependency relationship
- State semantics more accurately and formally; then write new semantics using Object Constraint Language (OCL)