9.1 Language Architecture
The UML is defined within a scheme called a
four-layer metamodeling architecture that
involves four distinct layers or levels of abstraction. Each layer
defines elements, concepts, and relationships between concepts, based
on the types of elements in the next more general layer.
For example, consider how we define programming languages and
programs using the following layers:
- The meta-metamodel or M3-level layer
-
At the most abstract layer, we define the concepts
of data, processing, input, and output where processing inputs and
outputs data.
- The metamodel or M2-level layer
-
At the next more specific layer, we can define
programming languages that have specific data types and types of
processing statements using the concepts of data and processing
defined at the M3-level layer. For example, Java has the
byte, short,
int, long,
char, float, and
double data types, and it has the
if, while,
do, for,
break, continue, and
return processing statements.
- The model or M1-level layer
-
At the next more specific layer, we can define programs that use
specific data types and specific processing statements using the
types of elements defined at the M2-level layer — for example,
a Java program that uses int and
char string variables within a
for loop to count the number of characters in a
string.
- The user model or M0-level layer
-
At the next more-specific layer, we can execute programs
— for example, a Java program that counts the number of
characters in a string such as "I Love
UML," which has 10 characters.
Within this scheme, as each layer has more concrete or specific
elements, the "meta" phrase is
dropped and the layer number decreases.
For a programming language, the M2-level layer defines the
programming language with data types and types of processing
statements, the M1-level layer defines a program with specific data
variables and specific processing statements using the elements
defined in the M2-level layer, and the M0-level layer is an executing
program that is defined in the M1-level layer using the data types
and types of processing statements defined in the M2-level layer.
This is very natural in that an executing program (M0-level layer) is
an instance or a specific execution of a defined program (M1-level
layer) that uses the data types and types of processing statements of
the programming language (M2-level layer).
Similarly, for the UML, we say a model, depicted using class
diagrams, is an instance of a metamodel; a user model, depicted using
object diagrams, is an instance of a model depicted using class
diagrams; a user model, depicted using object diagrams, is an
instance of a metamodel; and objects and links are instances of their
classes and associations.
This scheme of defining and organizing a language is important in
helping us define the language and how it is used; otherwise, a
language would be a hodgepodge of different types of modeling
elements, concepts, and relationships between concepts, without any
thought of how the language is defined and how it may be used.
Similar to how the Java programming language is defined at the
metamodel layer, the UML is defined at the metamodel layer as
follows:
- The meta-metamodel or M3-level layer
-
The UML standard defines the notion of a concept.
- The metamodel or M2-level layer
-
The UML standard defines the concepts of Class,
Attribute, Operation,
Object, Attribute
Value, Association,
Link, and so forth, which include all the concepts
that compose the UML. Each class in the metamodel is known as a
metaclass.
- The model or M1-level layer
-
We define specific classes, attributes, operations, and associations
— for example, all the classes and associations with all their
detail pertaining to the project management system discussed
throughout the book.
- The user model or M0-level layer
-
We define specific objects, attribute values, and links — for
example, all the objects and links with all their detail pertaining
to the project management system discussed throughout the book.
To ensure that the UML remains standardized, we are unable to modify
the metamodel that defines the language. But to ensure that the UML
is extensible, we are able to extend the language by defining new
concepts using stereotypes, describing them using properties, and
packaging and reusing them using profiles.
|