Type safe dynamic object delegation in class-based languages

  • Authors:
  • Lorenzo Bettini;Viviana Bono

  • Affiliations:
  • Università di Torino, Torino - Italy;Università di Torino, Torino - Italy

  • Venue:
  • Proceedings of the 6th international symposium on Principles and practice of programming in Java
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

Class inheritance and method overriding, as provided by standard class-based languages, are not flexible enough to represent the dynamic behavior of objects; with this respect, object composition and delegation are often advocated as a more flexible alternative to class inheritance since they act at run-time, thus permitting the behavior of objects to be specialized dynamically. In this paper we present Incomplete Featherweight Java (IFJ), an extension of Featherweight Java with incomplete objects, i.e., objects that require some missing methods which can be provided at run-time by composition with another (complete) object. The mechanism for method invocation is based on delegation and it is 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 clashes.