Traits: A mechanism for fine-grained reuse

Inheritance is well-known and accepted as a mechanism for reuse in object-oriented languages. Unfortunately, due to the coarse granularity of inheritance, it may be difficult to decompose an application into an optimal class hierarchy that maximizes software reuse. Existing schemes based on single inheritance, multiple inheritance, or mixins, all pose numerous problems for reuse. To overcome these problems we propose traits, pure units of reuse consisting only of methods. We develop a formal model of traits that establishes how traits can be composed, either to form other traits, or to form classes. We also outline an experimental validation in which we apply traits to refactor a nontrivial application into composable units.

[1]  Ole Lehrmann Madsen,et al.  Strong typing of object-oriented languages revisited , 1990, OOPSLA/ECOOP '90.

[2]  Bruce W. Weide,et al.  Experience report: using RESOLVE/C++ for commercial software , 2000, SIGSOFT '00/FSE-8.

[3]  Gilad Bracha,et al.  Mixins in Strongtalk , 2002 .

[4]  Gregor Kiczales,et al.  Aspect-oriented programming , 2001, ESEC/FSE-9.

[5]  David Notkin,et al.  Using role components in implement collaboration-based designs , 1996, OOPSLA '96.

[6]  Yannis Smaragdakis,et al.  Implementing Layered Designs with Mixin Layers , 1998, ECOOP.

[7]  David A. Moon,et al.  A monotonic superclass linearization for Dylan , 1996, OOPSLA '96.

[8]  Hannu Koivisto Aspect-oriented programming in common lisp , 2002 .

[9]  William G. Griswold,et al.  An Overview of AspectJ , 2001, ECOOP.

[10]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[11]  Ira R. Forman,et al.  Putting metaclasses to work: a new dimension in object-oriented programming , 1999 .

[12]  Daniel E. Lipkie,et al.  Traits: An approach to multiple-inheritance subclassing , 1982, COCS.

[13]  Fred Rivard Evolution du comportement des objets dans les langages a classes reflexifs , 1997 .

[14]  Bruce W. Weide,et al.  Part III: implementing components in RESOLVE , 1994, SOEN.

[15]  Daniel G. Bobrow,et al.  Representing design alternatives , 1980 .

[16]  David A. Moon Object-oriented programming with flavors , 1986, OOPSLA 1986.

[17]  Gilad Bracha,et al.  Strongtalk: typechecking Smalltalk in a production environment , 1993, OOPSLA '93.

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

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

[20]  Tom Mens,et al.  Encapsulation and composition as orthogonal operators on mixins: a solution to multiple inheritance problems , 1996, Object Oriented Syst..

[21]  Yannis Smaragdakis Layered Development with (Unix) Dynamic Libraries , 2002, ICSR.

[22]  Martin Odersky,et al.  An Overview of the Scala Programming Language , 2004 .

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

[24]  Daniel G. Bobrow,et al.  Descriptions for a Programming Environment , 1980, AAAI.

[25]  Oscar Nierstrasz,et al.  Composable Encapsulation Policies , 2004, ECOOP.

[26]  Bruce W. Weide,et al.  Part IV: RESOLVE components in Ada and C++ , 1994, SOEN.

[27]  Thomas Ledoux,et al.  Explicit Metaclasses as a Tool for Improving the Design of Class Libraries , 1996, ISOTAS.

[28]  Joseph Eugene Hollingsworth Software component design-for-reuse: a language-independent discipline applied to ADA , 1992 .

[29]  Harold Ossher,et al.  Subject-oriented programming: a critique of pure objects , 1993, OOPSLA '93.

[30]  Mira Mezini,et al.  Integrating independent components with on-demand remodularization , 2002, OOPSLA '02.

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

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

[33]  Nicolas Graube Metaclass Compatibility , 1989, OOPSLA.

[34]  N. Graube Metaclass compatibility , 1989, OOPSLA 1989.

[35]  Alan Borning,et al.  The Programming Language Aspects of ThingLab, a Constraint-Oriented Simulation Laboratory , 1981, TOPL.

[36]  A. Black,et al.  Applying Traits to the Smalltalk Collection Hierarchy Submitted to ECOOP 2003 ? , 2002 .

[37]  Randall B. Smith,et al.  Self: The power of simplicity , 1987, OOPSLA 1987.

[38]  Joseph Gil,et al.  Space and time-efficient memory layout for multiple inheritance , 1999, OOPSLA '99.

[39]  S. E. Keene,et al.  A programmer's guide to object-oriented programming in Common LISP , 1988 .

[40]  David A. Moon,et al.  Object-oriented programming with flavors , 1986, OOPLSA '86.

[41]  Don S. Batory,et al.  Scaling step-wise refinement , 2004, IEEE Transactions on Software Engineering.

[42]  Daniel G. Bobrow,et al.  Book review: The Art of the MetaObject Protocol By Gregor Kiczales, Jim des Rivieres, Daniel G. and Bobrow(MIT Press, 1991) , 1991, SGAR.

[43]  Daniel G. Bobrow,et al.  Object-Oriented Programming: Themes and Variations , 1989, AI Mag..

[44]  Jens Palsberg,et al.  A Denotational Semantics of Inheritance and its Correctness , 1989, OOPSLA.

[45]  Yannis Smaragdakis,et al.  Mixin-Based Programming in C++ , 2000, GCSE.

[46]  Stanley B. Zdonik,et al.  Inheritance as an Incremental Modification Mechanism or What Like Is and Isn't Like , 1988, ECOOP.

[47]  Terry A. McKee,et al.  OOPSLA '89 Conference proceedings on Object-oriented programming systems, languages and applications , 1989 .

[48]  Alan Snyder Encapsulation and inheritance in object-oriented programming languages , 1986, OOPSLA 1986.

[49]  John Maloney,et al.  Back to the Future The Story of Squeak, A Practical Smalltalk Written in Itself , 1997 .

[50]  Stephen H. Edwards,et al.  Part II: specifying components in RESOLVE , 1994, SOEN.

[51]  James J. Horning,et al.  The Larch Family of Specification Languages , 1985, IEEE Software.

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

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

[54]  Markku Sakkinen,et al.  Disciplined Inheritance , 1989, ECOOP.

[55]  Dominic Duggan,et al.  Modular mixin-based inheritance for application frameworks , 2001, OOPSLA '01.

[56]  Bertrand Meyer,et al.  Eiffel: The Language , 1991 .

[57]  Markku Sakkinen The Darker Side of C++ Revisited , 1992, Struct. Program..

[58]  Nathanael Schärli,et al.  A browser for incremental programming , 2004, Comput. Lang. Syst. Struct..

[59]  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).

[60]  Daniel G. Bobrow,et al.  On Overview of KRL, a Knowledge Representation Language , 1976, Cogn. Sci..

[61]  Don S. Batory,et al.  The design and implementation of hierarchical software systems with reusable components , 1992, TSEM.

[62]  Mads Torgersen,et al.  The c# programming language, third edition , 2008 .

[63]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[64]  Nathanael Schärli,et al.  Traits: tools and methodology , 2004, Proceedings. 26th International Conference on Software Engineering.

[65]  M A R C V A N L I M B E R G H E N,et al.  Encapsulation and composition as orthogonal operators on mixins: a solution to multiple inheritance problems , 1996 .

[66]  Thomas Ledoux,et al.  Safe metaclass programming , 1998, OOPSLA '98.

[67]  Noury Bouraqadi,et al.  Safe metaclass composition using mixin-based inheritance , 2004, Comput. Lang. Syst. Struct..

[68]  Giuseppe Castagna,et al.  Covariance and contravariance: conflict without a cause , 1995, TOPL.

[69]  Adrian Lienhard Bootstrapping Traits , 2004 .

[70]  Stuart H. Zweben,et al.  Part I: the RESOLVE framework and discipline: a research synopsis , 1994, SOEN.

[71]  Paul Schweizer,et al.  A fast method dispatcher for compiled languages with multiple inheritance , 1989, OOPSLA '89.

[72]  David R. Musser,et al.  STL tutorial and reference guide, second edition: C++ programming with the standard template library , 2001 .

[73]  Pierre Cointe Metaclasses are First Class: the ObjVlisp Model , 1987, OOPSLA.

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

[75]  Pierre Cointe Metaclasses are first class: The ObjVlisp Model , 1987, OOPSLA 1987.

[76]  Markus Mohnen Interfaces with default implementations in Java , 2002, PPPJ/IRE.

[77]  Mira Mezini,et al.  Dynamic Object Evolution without Name Collisions , 1997, ECOOP.

[78]  AmericaPierre,et al.  A parallel object-oriented language with inheritance and subtyping , 1990 .

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

[80]  Günter Kniesel Type-Safe Delegation for Run-Time Component Adaptation , 1999, ECOOP.

[81]  Wilf R. LaLonde Designing families of data types using exemplars , 1989, TOPL.

[82]  Nathanael Schärli,et al.  Uniform and safe metaclass composition , 2005, Comput. Lang. Syst. Struct..

[83]  Gregor Kiczales,et al.  Aspect-oriented programming , 1996, CSUR.

[84]  Daniel H. H. Ingalls,et al.  The Smalltalk-76 programming system design and implementation , 1978, POPL.

[85]  Antero Taivalsaari,et al.  On the notion of inheritance , 1996, CSUR.

[86]  Luca Cardelli,et al.  On Binary Methods , 1995, Theory Pract. Object Syst..

[87]  Marie-Laure Mugnier,et al.  Monotonic conflict resolution mechanisms for inheritance , 1992, OOPSLA.

[88]  David Notkin,et al.  Using C++ Templates to Implement Role-Based Designs , 1996, ISOTAS.

[89]  Marie-Laure Mugnier,et al.  Monotonic conflict resolution mechanisms for inheritance , 1992, OOPSLA 1992.

[90]  Davide Ancona,et al.  Jam - A Smooth Extension of Java with Mixins , 2000, ECOOP.

[91]  Jens Palsberg,et al.  A Denotational Semantics af Inheritance and its Correctness , 1989 .

[92]  Jaakko Järvi,et al.  The Lambda Library: unnamed functions in C++ , 2003, Softw. Pract. Exp..

[93]  Wilf R. LaLonde,et al.  Smalltalk: subclassing subtyping is-a , 1991 .

[94]  William R. Cook,et al.  Interfaces and specifications for the Smalltalk-80 collection classes , 1992, OOPSLA.

[95]  Ira P. Goldstein,et al.  NUDGE, A Knowledge-Based Scheduling Program , 1977, IJCAI.

[96]  Arthur J. Riel,et al.  Object-Oriented Design Heuristics , 1996 .

[97]  Cristina V. Lopes,et al.  Aspect-oriented programming , 1999, ECOOP Workshops.

[98]  David R. Musser,et al.  STL tutorial and reference guide , 2001 .

[99]  Daniel G. Bobrow,et al.  Extending object oriented programming in Smalltalk , 1980, LISP Conference.

[100]  Pierre America,et al.  A parallel object-oriented language with inheritance and subtyping , 1990, OOPSLA/ECOOP '90.

[101]  Howard I. Cannon Flavors : A non-hierarchical approach to object-oriented programming , 2007 .

[102]  Randall B. Smith,et al.  SELF: The power of simplicity , 1987, OOPSLA '87.

[103]  Bruce Weide,et al.  Component-based software using RESOLVE , 1994, SOEN.