Title
Traits: Composable Units of Behavior
Abstract
Inheritance is the fundamental reuse mechanism in object-oriented programming languages; its most prominent variants are single inheritance, multiple inheritance, and mixin inheritance. In the first part of this paper, we identify and illustrate the conceptual and practical reusability problems that arise with these forms of inheritance. We then present a simple compositional model for structuring object-oriented programs, which we call traits. Traits are essentially groups of methods that serve as building blocks for classes and are primitive units of code reuse. In this model, classes are composed from a set of traits by specifying glue code that connects the traits together and accesses the necessary state. We demonstrate how traits overcome the problems arising with the different variants of inheritance, we discuss how traits can be implemented effectively, and we summarize our experience applying traits to refactor an existing class hierarchy.
Year
DOI
Venue
2003
10.1007/978-3-540-45070-2_12
ECOOP
Keywords
DocType
Volume
fundamental reuse mechanism,mixin inheritance,mixins,object-oriented programming language,reuse,object-oriented program,different variant,simple compositional model,inheritance,smalltalk,single inheritance,code reuse,composable units,multiple inheritance,traits,glue code,object oriented programming languages,object oriented programming
Conference
2743
ISSN
Citations 
PageRank 
0302-9743
178
9.17
References 
Authors
27
4
Search Limit
100178
Name
Order
Citations
PageRank
Nathanael Sch arli11789.17
Stéphane Ducasse23418243.15
Oscar Nierstrasz32404346.86
Andrew P. Black41566366.84