Title
Featherweight Jigsaw - Replacing inheritance by composition in Java-like languages
Abstract
We present FJig, a simple calculus where basic building blocks are classes in the style of Featherweight Java, declaring fields, methods and one constructor. However, inheritance has been generalized to the much more flexible notion originally proposed in Bracha@?s Jigsaw framework. That is, classes play also the role of modules, that can be composed by a rich set of operators, all of which can be expressed by a minimal core. Fields and methods can be declared of four different kinds (abstract, virtual, frozen, local) determining how they are affected by the operators. We keep the nominal approach of Java-like languages, that is, types are class names. However, a class is not necessarily a structural subtype of any class used in its defining expression. While this allows a more flexible reuse, it may prevent the (generalized) inheritance relation from being a subtyping relation. So, the required subtyping relations among classes are declared by the programmer and checked by the type system. The calculus allows the encoding of a large variety of different mechanisms for software composition in class-based languages, including standard inheritance, mixin classes, traits and hiding. Hence, FJig can be used as a unifying framework for analyzing existing mechanisms and proposing new extensions. We provide two different semantics of an FJig program: flattening and direct semantics. The difference is analogous to that between two intuitive models to understand inheritance: the former where inherited methods are copied into heir classes, and the latter where member lookup is performed by ascending the inheritance chain. Here we address equivalence of these two views for a more sophisticated composition mechanism.
Year
DOI
Venue
2012
10.1016/j.ic.2012.02.004
Inf. Comput.
Keywords
Field
DocType
mixin class,heir class,different semantics,class name,inheritance chain,java-like language,featherweight jigsaw,different kind,different mechanism,inheritance relation,fjig program,standard inheritance
Discrete mathematics,Composition over inheritance,Programming language,Mixin,Computer science,Theoretical computer science,Function composition (computer science),Equivalence (measure theory),Operator (computer programming),Subtyping,Java,Semantics
Journal
Volume
ISSN
Citations 
214,
0890-5401
8
PageRank 
References 
Authors
0.44
19
3
Name
Order
Citations
PageRank
Giovanni Lagorio121217.98
Marco Servetto26111.51
Elena Zucca3497101.25