Warming up ISA
Iteration 4: Overview of the ll type system
Introduction
For didactic purpose, this presentation of the type system is not fully aligned with the ll meta-model. For a complete type system reference specification, refer to Theme : LL first meta-model – LL Assembly |
At the very root of all object Oriented type system is the notion of Type. So let's define what is this.
A Type is the concept defining a collection of objects characterized by functions, axioms and preconditions. |
This is a first notion as it is expressed in the ll meta-model.
Another corner stone is the notion of Module.
A module is a manufactured unit. The modules are assembled together to build a system. |
At the heart of object Orientation is the join of these 2 concepts to form a Class. In ISA, the notion of classifier is introduced in order to be a little bit wider that in a pure OO approach (our classifier is close of the one in UML). Here is a first class diagram.
Several things are notable about shapes:
- Modeling style is directly derived from the UML.
- Meta-classes, those of the ll meta-model, are written in black on dark orange █ . Their logo is a M.
- An interface is also a classifier.
- As the interface name is used several time, the path of the place it is used is specified. Here the namespace is
ISA\ll\Metamodel
.
In the second illustration, several additions are made:
- The major properties on Type, like functions, axioms and preconditions .
- The Valuable meta-class, what is it ? It is the representation of the concept of pure value. An entity that is only defined by its value. Two entities having the same value are always equals.
- A Valuable is not a Module (it not always needs to be engineered), but it is a Type. Think to the Integer numbers for instance.
- Other new meta-class: Nomenclature. Here is represented the concept of nominal types. Entities that are defined only by their name. An example of nominal type is the Sex that only have 3 possible values: Male, Female or Indeterminable.
- The names property specifies this set of possible values.
At this point the programming language efficiency joins the game. The LL capability to deliver high performance. To do that we do need some primitive types like they also exist in many “OO” languages. Please remember from previous posts, where it is stated the possibility for ISA to derogate to the pure OO paradigm. It is here where pragmaticism is helpful to not only adhere to theory, but to be also nourished by the experience. In LL, those elementary types are called Element.
Several new things !
- Element, the raw elementary building blocks in LL, are written in black on mauve █ . Their logo is a E.
- Type, again, but in
ISA\LL\model
. This Type is the instantiation of the Type class inISA\LL\Metamodel
.
This is why there is a dependency link between these 2 classes (the dashed line with an arrow ).
These LL model classes are represented in a white class box █ with the C logo. - Similarly, the Single class is part of the LL Model. It represents an instantiation of the Valuable meta-class.
“Single” means that is has a single value (64 bits). - On the Single shape, the first compartment is about the class fields (name), and the second about the object fields (value).
- The Element represented by the class Integer is also a Single. The Integer class provides a computing support for one element of the mathematics ℤ set.
It has a single 64 bits value and is a primitive type of LL. - The Boolean class is also an Element and a Single, like Integer. But it instantiate Nomenclature.
The value domain only has 2 names: False and True.
Let's model a little
Now that we have some building blocks, it is possible to model a person having a first name, a sex and that may be bald.
- Person: Is a class having 3 fields: First name, Bald and Sex.
- Sex is a Nomenclature having 3 possible values: Female, Male, Indeterminable.
Like all model artifact, Nomenclature are shown in a white █ box, but with a dotted border and a N logo. - Person inherit of object. All objects in LL inherits of object.
- Not surprisingly, Object inherits from both Type and Module.
- A Module defines a namespace and have a Path in the containment hierarchy.
…and now let's instantiate this model
- Luc is an instance of Person. He is not bald while being a male.
- Instances are picton blue █ with a O logo for objects and minuscule for the others.