Implementing software product lines using traits

A software product line (SPL) is a set of software systems with well-defined commonalities and variabilities that are developed by managed reuse of common artifacts. In this paper, we present a novel approach to implement SPL by fine-grained reuse mechanisms which are orthogonal to class-based inheritance. We introduce the Featherweight Record-Trait Java (FRTJ) calculus where units of product functionality are modeled by traits, a construct that was already shown useful with respect to code reuse, and by records, a construct that complements traits to model the variability of the state part of products explicitly. Records and traits are assembled in classes that are used to build products. This composition of product functionalities is realized by explicit operators of the calculus, allowing code manipulations for modeling product variability. The FRTJ type system ensures that the products in the SPL are type-safe by type-checking only once the records, traits and classes shared by different products. Moreover, type-safety of an extension of a (type-safe) SPL can be guaranteed by checking only the newly added parts.

[1]  Oscar Nierstrasz,et al.  Flattening Traits , 2006, J. Object Technol..

[2]  Viviana Bono,et al.  Separating Type, Behavior, and State to Achieve Very Fine-grained Reuse , 2007 .

[3]  Oscar Nierstrasz,et al.  Traits: A mechanism for fine-grained reuse , 2006, TOPL.

[4]  Viviana Bono,et al.  On Traits and Types in a Java-like Setting , 2008, IFIP TCS.

[5]  William R. Cook,et al.  Safe composition of product lines , 2007, GPCE '07.

[6]  Sven Apel,et al.  Feature featherweight java: a calculus for feature-oriented programming and stepwise refinement , 2008, GPCE '08.

[7]  Elena Zucca,et al.  Featherweight Jigsaw: A Minimal Core Calculus for Modular Composition of Classes , 2009, ECOOP.

[8]  Stéphane Ducasse,et al.  Redesigning with traits: the Nile stream trait-based library , 2007, ICDL '07.

[9]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 1999, OOPSLA '99.

[10]  Davide Ancona,et al.  Polymorphic bytecode: compositional compilation for Java-like languages , 2005, POPL '05.

[11]  Paul G. Bassett,et al.  Framing software reuse: lessons from the real world , 1996 .

[12]  Sophia Drossopoulou,et al.  Chai: Traits for Java-Like Languages , 2005, ECOOP.

[13]  Don Batory,et al.  Scaling step-wise refinement , 2003, 25th International Conference on Software Engineering, 2003. Proceedings..

[14]  Roberto Erick Lopez-Herrejon,et al.  Evaluating Support for Features in Advanced Modularization Technologies , 2005, ECOOP.

[15]  Sven Apel,et al.  Granularity in software product lines , 2008, 2008 ACM/IEEE 30th International Conference on Software Engineering.

[16]  Yannis Smaragdakis,et al.  Mixin layers: an object-oriented implementation technique for refinements and collaboration-based designs , 2002, TSEM.

[17]  Luigi Liquori,et al.  FeatherTrait: A modest extension of Featherweight Java , 2008, TOPL.

[18]  Craig Chambers,et al.  Organizing programs without classes , 1991, LISP Symb. Comput..

[19]  E. Zucca,et al.  Flattening versus direct semantics for Featherweight Jigsaw ∗ , 2007 .

[20]  C. H. Flood,et al.  The Fortress Language Specification , 2007 .

[21]  Oscar Nierstrasz,et al.  Stateful traits and their formalization , 2008, Comput. Lang. Syst. Struct..

[22]  Paul Clements,et al.  Software product lines - practices and patterns , 2001, SEI series in software engineering.

[23]  Oscar Nierstrasz,et al.  Traits: Composable Units of Behaviour , 2002, ECOOP.

[24]  William R. Cook,et al.  A machine-checked model of safe composition , 2009, FOAL '09.

[25]  Emil Sekerinski,et al.  A Study of The Fragile Base Class Problem , 1998, ECOOP.

[26]  Nathanael Schärli,et al.  Applying traits to the smalltalk collection classes , 2002, OOPSLA '03.

[27]  Aaron Turon,et al.  Metaprogramming with Traits , 2007, ECOOP.

[28]  Sven Apel,et al.  A Case Study Implementing Features Using AspectJ , 2007, 11th International Software Product Line Conference (SPLC 2007).

[29]  Sven Apel,et al.  Type-Checking Software Product Lines - A Formal Approach , 2008, 2008 23rd IEEE/ACM International Conference on Automated Software Engineering.