Traits: The Formal Model

Schärli, Nathanael; Nierstrasz, Oscar; Ducasse, Stéphane; Wuyts, Roel; Black, Andrew (2002). Traits: The Formal Model Universität Bern, Switzerland: Universität Bern

[img] Text
Scha02cTraitsModel.pdf - Published Version
Restricted to registered users only
Available under License Publisher holds Copyright.

Download (222kB) | Request a copy

Single-inheritance in object-oriented languages can lead to duplicated code in rich class libraries where feature-sharing cannot be linearized. Multiple-inheritance and mixins alleviate this problem, but lead to other difficulties in the face of evolution. Changes to classes or mixins can break code lower in the hierarchy in unexpected ways. Traits solve both problems by factoring out shared behaviour as sets of methods that do not depend on state. Traits have the important property that composition is symmetric, so changes do not lead to unexpected side effects. We present a formal model of traits, and define some basic properties of traits and classes.

Item Type:

Report (Report)


08 Faculty of Science > Institute of Computer Science (INF)
08 Faculty of Science > Institute of Computer Science (INF) > Software Composition Group (SCG)

UniBE Contributor:

Nierstrasz, Oscar Marius


000 Computer science, knowledge & systems
500 Science > 510 Mathematics


Universität Bern




Manuela Bamert

Date Deposited:

04 Dec 2017 09:35

Last Modified:

21 Nov 2019 03:00

Additional Information:

Also available as Technical Report CSE-02-013, OGI School of Science & Engineering, Beaverton, Oregon, USA




Actions (login required)

Edit item Edit item
Provide Feedback