Schärli, Nathanael; Ducasse, Stéphane; Nierstrasz, Oscar; Black, Andrew P. (July 2003). Traits: Composable Units of Behavior. In: European Conference on Object-Oriented Programming. LNCS: Vol. 2743 (pp. 248-274). Berlin Heidelberg: Springer Verlag 10.1007/b11832
Text
Scha03aTraits.pdf - Published Version Restricted to registered users only Available under License Publisher holds Copyright. Download (195kB) |
Despite the undisputed prominence of inheritance as the fundamental reuse mechanism in object-oriented programming languages, the main variants —- single inheritance, multiple inheritance, and mixin inheritance —- all suffer from conceptual and practical problems. In the first part of this paper, we identify and illustrate these problems. We then present traits, a simple compositional model for structuring object-oriented programs. A trait is essentially a group of pure methods that serves as a building block for classes and is a primitive unit 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 from 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.
Item Type: |
Conference or Workshop Item (Paper) |
---|---|
Division/Institute: |
08 Faculty of Science > Institute of Computer Science (INF) 08 Faculty of Science > Institute of Computer Science (INF) > Software Composition Group (SCG) [discontinued] |
UniBE Contributor: |
Ducasse, Stephane, Nierstrasz, Oscar |
Subjects: |
000 Computer science, knowledge & systems 500 Science > 510 Mathematics |
ISBN: |
978-3-540-40531-3 |
Series: |
LNCS |
Publisher: |
Springer Verlag |
Language: |
English |
Submitter: |
Anja Ebeling |
Date Deposited: |
22 Nov 2017 16:07 |
Last Modified: |
11 Apr 2024 16:11 |
Publisher DOI: |
10.1007/b11832 |
BORIS DOI: |
10.7892/boris.104761 |
URI: |
https://boris.unibe.ch/id/eprint/104761 |