Title of article
Delegation by object composition
Author/Authors
Lorenzo Bettini، نويسنده , , Betti Venneri and Viviana Bono ، نويسنده , , Betti Venneri، نويسنده ,
Issue Information
ماهنامه با شماره پیاپی سال 2011
Pages
23
From page
992
To page
1014
Abstract
Class inheritance and method overriding, as provided by standard class-based languages, are often not flexible enough to represent objects with some dynamic behavior. In this respect, object composition equipped with different forms of method body lookup is often advocated as a more flexible alternative to class inheritance since it takes place at run time, thus permitting the behavior of objects to be specialized dynamically. In this paper, we illustrate Incomplete Featherweight Java (IFJ), an extension of Featherweight Java with a novel linguistic construct, the incomplete object. Incomplete objects require some missing methods which can be provided at run time by composition with another (complete) object. Furthermore, we present two mechanisms for the method body lookup on (composed) objects, one based on delegation and the other based on consultation. Thanks to the design of the language, the consultation-based lookup is a simple extension of the delegation-based one. Both mechanisms are disciplined by static typing, therefore the language enjoys type safety (which implies no “message-not-understood” run-time errors) and avoids possible accidental overrides due to method name clashes.
Keywords
Language extensions , Featherweight Java , Delegation , Object composition , consultation
Journal title
Science of Computer Programming
Serial Year
2011
Journal title
Science of Computer Programming
Record number
1080218
Link To Document