• LOGIN
    Login with username and password
Repository logo

BORIS Portal

Bern Open Repository and Information System

  • Publications
  • Theses
  • Research Data
  • Projects
  • Organizations
  • Researchers
  • More
  • Collections
  • Statistics
  • LOGIN
    Login with username and password
Repository logo
Unibern.ch
  1. Home
  2. Publications
  3. Traits: Composable Units of Behavior

Traits: Composable Units of Behavior

Details
Files
DOI
10.7892/boris.104759
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.
Date Issued
2002-11
Publication Type
Report
Subject(s)
000 Computer science, knowledge & systems
500 Science > 510 Mathematics
Language(s)
en
Author(s)
Schärli, Nathanael
Ducasse, Stephane  
Institut für Informatik (INF)  
Nierstrasz, Oscar  
Institut für Informatik (INF)  
Black, Andrew P.
Additional Credits
Institut für Informatik (INF)  
Publisher
Universität Bern
Access(Rights)
restricted
Show full item
BORIS Portal
Bern Open Repository and Information System
Build: 0eaa7c [ 7.08. 11:06]
Explore
  • Projects
  • Funding
  • Publications
  • Research Data
  • Organizations
  • Researchers
  • Audiovisual Material
  • Software & other digital items
  • Events
More
  • About BORIS Portal
  • BORIS Portal & Open Science
  • Send Feedback
  • Cookie settings
  • Service Policy
Follow us on
  • Mastodon
  • YouTube
  • LinkedIn
UniBe logo
Repository logo COAR Notify