16th European Conference on Object-Oriented Programming
University of Málaga, Spain
June 10-14, 2002
Technical programme > posters
General Information
Call for Contributions
Technical Programme
Useful Information
Social Programme

<< Site map >>
<< History file >>

Ecoop 2002 is organized in cooperation with:
Important dates
Oct 01
Nov 01
Dec 01
Jan 02
Feb 02
Apr 02
May 02
Jun 02

You are the visitor number

from 4th October 2001.


Poster #8 - Darwin and Lava - Object-based Dynamic Inheritance in Java

next poster


Guenter Kniesel
Computer Science Department III University of Bonn
Roemerstr. 164
D-53117 Bonn
Phone: (+49-228) 73-45
Fax: (+49-228) 73-4382


The traditional notion of inheritance, which dates back to Simula 1967 and Smalltalk 78, has often been criticized as being too rigid to express dynamic evolution of structure and behaviour and too coarsegrained to express object-specific sharing of state and behaviour. A more expressive alternative, objectbased dynamic inheritance, also known as delegation, was proposed in 1987 by Henry Liebermann. However, it has not yet made its way into mainstream object-oriented languages on the premise of its assumed inefficiency and incompatibility with static typing.

The Darwin model and its proof of concept implementation, LAVA, an extension of Java, refute these assumptions [1]. They support statically type safe delegation and the new LAVA implementation shows that the code for dynamic inheritance generated by a compiler does not need to be less efficient than manual encoding of the same functionality.

In LAVA, object-based inheritance can be specified simply by adding the keyword delegatee to a variable declaration, e.g. "delegatee FinancialComponent _parent". Objects referenced by such variables are called parents. The effect of inheriting methods and state is achieved by automatically forwarding locally undefined method and variable accesses to parents. When an applicable method is found in a parent it is executed after binding this to the initial message receiver. This binding of this is the defining characteristic of delegation. It lets methods of delegating objects override methods of their parents, just like subclass methods override superclass methods in class-based languages.

In LAVA, determination of the "inherited" code and of part of the inherited interface can take place at object instantiation time or can be fully dynamic.
In the first case we talk about "fixed" delegation and use the usual Java keyword final to indicate that after initialisation parent objects cannot be exchanged. Fixed delegation is particularly interesting because it can be fully unanticipated – objects instantiated from any class can be used as parents. The implementation of parent classes does not need to be aware of delegation and does not need to include any hooks to enable delegation. So delegation can be used as a mechanism for adaptation of existing objects to unanticipated changes in their environment [2].

LAVA shows that fully dynamic ("mutable") delegation has to be anticipated in order to make it compatible with static typing. The main idea is that classes whose subclass instances may be used as dynamically exchangeable parents must be annotated with a keyword that indicates this intended use.

The poster motivates the need for object-based and dynamic inheritance, presents the contributions of LAVA and DARWIN in this field, describes the introduced language extensions and explains some of the main problems encountered and how they have been solved.

[1] Günter Kniesel, "Darwin -- Dynamic Object-Based Inheritance with Subtyping", PhD thesis, CS Dept. III, University of Bonn, Germany, July 2000.
[2] Günter Kniesel, "Type-Safe Delegation for Run-Time Componen Adaptation", in Rachid Guerraoui (ed), ECOOP'99 Conference Proceedings, Springer LNCS 1628, p. 351-366, 1999.

Additional Information

Darwin Website: http://javalab.cs.uni-bonn.de/research/darwin/

Personal homepage: http://www.cs.uni-bonn.de/~gk/

Poster #8 - Darwin and Lava - Object-based Dynamic Inheritance in Java
Last modified on May 13, 2002
Maintained by webmaster@2002.ecoop.org