Challenges in the design of the package template mechanism

  • Authors:
  • Eyvind W. Axelsen;Fredrik Sørensen;Stein Krogdahl;Birger Møller-Pedersen

  • Affiliations:
  • University of Oslo, Oslo, Norway;University of Oslo, Oslo, Norway;University of Oslo, Oslo, Norway;University of Oslo, Oslo, Norway

  • Venue:
  • Transactions on Aspect-Oriented Software Development IX
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

Package Templates are a mechanism for writing modules meant for reuse, where each module (template) consists of a collection of classes. A package template must be instantiated in a program at compile time to form a set of ordinary classes, and during instantiation, the classes may be adapted by means of renaming, adding attributes (fields and methods), and supplying type parameters. An approach like this naturally gives rise to two distinct dimensions along which classes can be extended. One is the ordinary subclass dimension, while the other is comprised of the ability to adapt classes during instantiations. The latter dimension also allows for a form of static multiple inheritance, in that classes from two or more instantiations may be merged to form a new class. This will be handled entirely at compile time, and the new class will have all the attributes from the merged classes and also the attributes added in the instantiating template. This paper discusses how these two dimensions play together in the different mechanisms that make up the Package Templates approach, and the design considerations involved. The paper also argues that the compromise made in Package Templates between simplicity of the type system on the one hand and expressiveness on the other is, for most purposes, better than similar approaches based on virtual classes.