Are We Ready for a Safer Construction Environment?

  • Authors:
  • Joseph (Yossi) Gil;Tali Shragai

  • Affiliations:
  • Google, Inc., and The Technion,;The Technion,

  • Venue:
  • Genoa Proceedings of the 23rd European Conference on ECOOP 2009 --- Object-Oriented Programming
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

The semantics of many OO languages dictates that the constructor of a derived class is a refining extension of one of the base class constructors. As this base constructor runs, it may invoke dynamically bound methods which are overridden in the derived class. These invocations receive an "half baked object", i.e., an object whose derived class portion is uninitialized. Such a situation may lead to confusing semantics and to hidden coupling between the base and the derived. Dynamic binding within constructors also makes it difficult to enhance the programming language with advanced mechanisms for expressing design intent, such as non-null annotation (denoting reference values which can never be null), read-only annotation for fields and variables (expressing the intention that these cannot be modified after they are completely created) and class invariants (part of the famous design by contract methodology). A read-only field for example becomes immutable only after the creation of the enclosing object is complete.