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)

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)

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:

Nierstrasz, Oscar

Subjects:

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

Publisher:

Universität Bern

Language:

English

Submitter:

Anja Ebeling

Date Deposited:

04 Dec 2017 09:35

Last Modified:

11 Apr 2024 16:11

Additional Information:

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

BORIS DOI:

10.7892/boris.104760

URI:

https://boris.unibe.ch/id/eprint/104760

Actions (login required)

Edit item Edit item
Provide Feedback