Implementing type-safe software product lines using parametric traits

A software product line (SPL) is a set of related software systems with well-defined commonality and variability that are developed by reusing common artifacts. In this paper, we present a novel technique for implementing SPLs by exploiting mechanisms for fine-grained reuse which are orthogonal to class-based inheritance. In our approach the concepts of type, behavior, and state are separated into different and orthogonal linguistic concepts: interfaces, traits and classes, respectively. We formalize our proposal by means of Featherweight Parametric Trait Java (FPTJ), a minimal core calculus where units of product functionality are modeled by parametric traits. Traits are a well-known construct for fine-grained reuse of behavior. Parametric traits are traits parameterized by interface names and class names. Parametric traits are applied to interface names and class names to generate traits that can be assembled in other (possibly parametric) traits or in classes that are used to build products. The composition of product functionality is realized by explicit operators of the calculus, allowing code manipulations for modeling product variability. The FPTJ type system ensures that the products in the SPL are type-safe by inspecting the parametric traits and classes shared by different products only once. Therefore, type-safety of an extension of a (type-safe) FPTJ SPL can be guaranteed by inspecting only the newly added parts. We present a technique for implementing SPLs by mechanisms for fine-grained reuse.We formalize our proposal by means of a minimal core calculus.The type system ensures that all the products in the SPL are type-safe.Type-safety of SPL extensions can be checked by inspecting only newly added parts.

[1]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[2]  Ina Schaefer,et al.  Compositional type checking of delta-oriented software product lines , 2012, Acta Informatica.

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

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

[5]  Davide Ancona,et al.  Jam---designing a Java extension with mixins , 2003, TOPL.

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

[7]  Gilad Bracha,et al.  The programming language jigsaw: mixins, modularity and multiple inheritance , 1992 .

[8]  Martin Odersky,et al.  Independently Extensible Solutions to the Expression Problem , 2004 .

[9]  Matthias Felleisen,et al.  Classes and mixins , 1998, POPL '98.

[10]  Sven Apel,et al.  Family-based deductive verification of software product lines , 2012, GPCE '12.

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

[12]  Awais Rashid,et al.  Framed Aspects: Supporting Variability and Configurability for AOP , 2004, ICSR.

[13]  William R. Cook,et al.  Inheritance is not subtyping , 1989, POPL '90.

[14]  Lorenzo Bettini,et al.  Combining traits with boxes and ownership types in a Java-like setting , 2013, Sci. Comput. Program..

[15]  Sven Apel,et al.  Type safety for feature-oriented product lines , 2010, Automated Software Engineering.

[16]  Johan Dovland,et al.  Verifying traits: an incremental proof system for fine-grained reuse , 2014, Formal Aspects of Computing.

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

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

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

[20]  Ina Schaefer,et al.  TraitRecordJ: A programming language with traits and records , 2013, Sci. Comput. Program..

[21]  C. Krueger,et al.  Eliminating the adoption barrier , 2002, IEEE Software.

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

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

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

[25]  Andrew P. Black,et al.  Supporting Java traits in Eclipse , 2004, eclipse '04.

[26]  Luigi Liquori,et al.  Extending FeatherTrait Java with Interfaces , 2008, Theor. Comput. Sci..

[27]  Matthew J. Parkinson,et al.  The java module system: core design and semantic definition , 2007, OOPSLA.

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

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

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

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

[32]  Ina Schaefer,et al.  Compositional Type-Checking for Delta-Oriented Programming (version with Appendix) , 2011 .

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

[34]  Johan Dovland,et al.  A transformational proof system for delta-oriented programming , 2012, SPLC '12.

[35]  Mads Torgersen The Expression Problem Revisited , 2004, ECOOP.

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

[37]  Marc V An L I Mbe R Ghen Encapsulation and composition as orthogonal operators on mixins: a solution to multiple inheritance problems , 1996 .

[38]  Alan Snyder,et al.  Encapsulation and inheritance in object-oriented programming languages , 1986, OOPLSA '86.

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

[40]  Ina Schaefer,et al.  Pure delta-oriented programming , 2010, FOSD '10.

[41]  Viviana Bono,et al.  Delta-Oriented Programming of Software Product Lines , 2010, SPLC.

[42]  Andrew P. Black,et al.  Removing duplication from java.io: a case study using traits , 2005, OOPSLA '05.

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

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

[45]  Sara Capecchi,et al.  On flexible dynamic trait replacement for Java-like languages , 2013, Sci. Comput. Program..

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

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

[48]  Bertrand Meyer,et al.  Object-Oriented Software Construction, 2nd Edition , 1997 .

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

[50]  Johan Dovland,et al.  Verifying traits: a proof system for fine-grained reuse , 2011, FTfJP@ECOOP.

[51]  Aaron Turon,et al.  A foundation for trait-based metaprogramming , 2005 .

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

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

[54]  Reiner Hähnle,et al.  A Liskov Principle for Delta-Oriented Programming , 2012, ISoLA.

[55]  Don S. Batory,et al.  Feature Models, Grammars, and Propositional Formulas , 2005, SPLC.

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

[57]  簡聰富,et al.  物件導向軟體之架構(Object-Oriented Software Construction)探討 , 1989 .

[58]  William R. Cook,et al.  Mixin-based inheritance , 1990, OOPSLA/ECOOP '90.

[59]  Elena Zucca,et al.  Featherweight Jigsaw - Replacing inheritance by composition in Java-like languages , 2012, Inf. Comput..

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

[61]  Klaus Pohl,et al.  Software Product Line Engineering - Foundations, Principles, and Techniques , 2005 .

[62]  Kyo Chul Kang,et al.  Feature-Oriented Domain Analysis (FODA) Feasibility Study , 1990 .

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

[64]  Stanley M. Sutton,et al.  N degrees of separation: multi-dimensional separation of concerns , 1999, Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).

[65]  Lorenzo Bettini,et al.  Pure trait-based programming on the Java platform , 2013, PPPJ.

[66]  Erik Ernst,et al.  Propagating Class and Method Combination , 1999, ECOOP.

[67]  William R. Cook,et al.  Object-Oriented Programming Versus Abstract Data Types , 1990, REX Workshop.

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

[69]  Ina Schaefer,et al.  Implementing software product lines using traits , 2010, SAC '10.

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