16th European Conference on Object-Oriented Programming
University of Málaga, Spain
June 10-14, 2002
Technical programme > posters
You are the visitor number
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 . 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.
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.
Darwin Website: http://javalab.cs.uni-bonn.de/research/darwin/
Personal homepage: http://www.cs.uni-bonn.de/~gk/