Customization of Relationships between Types

A. Capouillez, R. Chignoli, P. Crescenzo and P. Lahire

Laboratoire I3S (UNSA/CNRS)
Projet OCL
2000, route des lucioles
Les Algorithmes, bâtiment Euclide B
BP 121
F-06903 Sophia Antipolis CEDEX

The problematics of our study is set in the framework of object-oriented languages providing notions of class and inheritance, especially in the perspective of software engineering. In these languages, such as Java [AG98], C++ [Str97] and Eiffel [Mey92], it is frequent to use the provided inheritance mechanism in order to implement different kinds of relationships. For instance, people use inheritance to implement a strict sub-typing as well as a basic source code reuse operation [Mey97]. This range in the use of inheritance demonstrates the very wide interest of this mechanism but also shows a straightforward default. It is very difficult for a programmer to specify what is the use he wishes to make of this mechanism, including all the consequences that it may imply according to control, readability, documentation, maintainability and evolution of programs.

Thus, our goal is to generalize and control the relationships between types, such as inheritance and client link. We also want to offer the ability to specify new relationships like generalization, code reuse, versioning, ... For that, we have defined a model, called OFL [CCCL00b, CCCL00a], dedicated to the customization of relationships (hyper-genericity [Des94]) between types in object-oriented languages [MNC+91, DEMN97]. The three main entities of this model are: relationship, description and language. We want to improve the system expressiveness by providing parameters which characterize the relationships. In order to describe relationship semantics, we will propose combinations of values for these parameters. Thus we will supply traditional relationships such as inheritance, client link or specialization and others, more original, such as generalization or code reuse.

A relationship-concept represents a kind of relationships between types. For instance, in Java, we have inheritance between classes (extends), inheritance between interfaces (extends), implementation between interfaces and a class (implements), ... A description-concept figures a sort of active container that we generally called class in object-oriented languages. In Java, we can find classes, interfaces, arrays, inner classes, ... Finally, a language-concept describes the notion of programming language. It is mainly a composition of relationship-concepts and description-concepts and a set of conditions to use them.

Each of these three concepts includes a set of parameters (for example: cardinality for the relationship-concept). They also have available algorithms called actions (for instance: lookup searches the right feature during dynamic binding) and boolean functions called controls (for instance: is_argument_valid verifies if the effective argument is compatible with the formal one) which take value of parameters into account. If the use of parameters are inadequate, the programmer can use meta-programming to change semantics of actions and controls. But this case must be exceptional.

On posters, we want to present some elements of our concepts of relationship, description and language. Then, we shall give some parameters and actions to show examples. At last, we shall show how to add a relationship for code reuse in Java.


[AG98] K. Arnold and J. Gosling. The Java Programming Language. The Java Serie... from the Source. Sun Microsystems, 2 edition, 1998.
[CCCL00a] Adeline Capouillez, Robert Chignoli, Pierre Crescenzo et Philippe Lahire. Gestion des objets persistants grâce aux liens entre classes. In OCM 2000 (Objets, Composants, Modèles « Passé, Présent, Futur » ), Nantes, France, mai 2000.
[CCCL00b] Adeline Capouillez, Robert Chignoli, Pierre Crescenzo and Philippe Lahire. How to Improve Persistent-Object Management using Relationship Information?. In WOON'2000 (4th International Conference "The White Object Oriented Nights"), Saint-Petersburg, Russie, June 2000.
[DEMN97] R. Ducournau, J. Euzenat, G. Masini, and A.Napoli. Langages et modèles à objets : état des recherches et perspectives. Collection didactique. INRIA, juillet 1997.
[Des94] P. Desfray. Object Engineering, the Fourth Dimension. Addison-Wesley Publishing Co., 1994.
[Mey92] B. Meyer. Eiffel: The Language. Object-Oriented Series. Prentice Hall, 1992.
[Mey97] B. Meyer. Object-Oriented Software Construction. Professional Technical Reference. Prentice Hall, 2 edition, 1997.
[MNC+91] G. Masini, A. Napoli, D. Colnet, D. Léonard, and K. Tombre. Les langages orientés objets : langages de classes, langages de frames, langages d'acteurs. MIT Press, 1991.
[Str97] B. Stroustrup. The C++ Programming Language. Addison-Wesley Publishing Co., 3 edition, 1997.