Filling the Gap between OO Methodologies and Programming Languages.
B.Rousseau, A.Aimar, A.Khodabandeh, P.Palazzi
Programming Techniques Group
CERN ECP Division, 1211 Geneva 23, Switzerland
Internet: rousseau@ptsun00.cern.ch
tel: (+41)-22 767 82 63
fax: (+41)-22-767 87 30
ABSTRACT
Object-Oriented methodologies like OMT provide abstractions that are not
directly supported by Object-Oriented Languages. We have designed a mapping to
embed these abstractions into Object-Oriented Languages, such as C++. This
mapping relies upon a meta object model of the entities of the OO methodology.
For each one of the meta objects we have defined operators which are being
implemented as a C++ library and a prototype is being tested. We report on the
result of applying this development to a realistic application.
CONTENT
Whilst Object-Oriented (OO) technology becomes more and more popular, it
suffers from a crucial gap between the methodologies and languages because most
OO languages do not offer native support for the high level abstractions and
notations provided by the methodologies. Considering the Object Modeling
Technique (OMT) as an example, concepts like association or aggregation have no
equivalent in C++ or Eiffel. Even the generalisation/specialisation abstraction
cannot be mapped directly onto an OO language because it contains more
semantics than inheritance. Current OO methodologies are fuzzy about the way
such abstractions should be implemented with most choices being left to the
programmer.
To overcome this problem CASE tools usually provide code generators, although
in most cases this facility is restricted to the production of simple classes
and method templates. This is not satisfactory for three reasons:
- No run time support is generated. For instance, associations between classes
are commonly mapped to pointers, but the operators to manipulate the
associations are left to the programmer (e.g. add or remove an association,
check cardinalities, navigate along an association).
- The mapping between the classes of the analysis and the classes of the
language is too simple and often not safe.
- No generic run-time support is generated. For instance, general purpose
methods to display instances, to manage subsets of instances of a given class,
or to print comprehensive error message must be programmed from scratch.
Well designed mappings between various OO methodologies and languages are
clearly required to solve these problems. The OPLA project elaborates such a
mapping for the OMT methodology and the C++ language.
Our work is guided by a set of properties that we believe to be required for a
good mapping:
- it implements the abstractions of the methodology,
- it provides a comprehensive set of operators to manipulate entities of the OO
Methodology. Using these operators, the programmer can focus on the high level
objects and is not concerned by too many implementation details,
- the resulting code is more readable and easier to maintain,
- it avoids the pitfalls of the OO Language (e.g. C++ pointers), and allows the
compiler to perform full static checking,
- it can be enforced by automatic code generation,
- it is efficient; among other ways, efficiency is achieved by generating the
operators for each class of the object model, whilst some other operators are
generic and are supplied as a library,
- it relies on abstract descriptions of the operators and can therefore be
easily generalised to other languages.
A first prototype of the mapping exists and is being tested. We report also on
the result of applying this development to a realistic application.