Inheritance is well-known and accepted as a mechanism for reuse in object-oriented languages. Unfortunately, due to the coarse granularity of inheritance, it may be difficult to decompose an application into an optimal class hierarchy that maximizes software reuse. Existing schemes based on single inheritance (e.g., in Java), multiple inheritance (e.g., in C++), or mixin (e.g., in Ruby), all pose numerous problems for reuse.
To overcome these problems, we designed a new composition mechanism called Traits , now included in programming languages such as PHP, Perl and Pharo/Smalltalk. Traits are pure units of behavior that can be composed to form classes or other traits. The trait composition mechanism is an alternative to multiple or mixin inheritance in which the composer has full control over the trait composition. The result enables more reuse than single inheritance without introducing the drawbacks of multiple or mixin inheritance.
Pharo (http://www.pharo-project.org) is a new open-source Smalltalk-inspired programming language and environment . It provides a platform for innovative development both in industry and research. Traits are
integrated in Pharo but barely used due to a lack of support in the development environment. The current implementation of traits in Pharo merges the trait methods into the classes that use the trait. This merging of external methods into classes makes the implementation of the development tools harder.
To solve this problem, the student will have to:
- evaluate alternative implementations of traits that do not merge methods into classes;
- implement the best alternative in Pharo (this alternative will have to be (un-)pluggable);
- adapt the Pharo development tools (e.g., code browser, refactoringtools, and versioning tools).
The project will be realized in the Pharo environment (http://www.pharo-project.org).
Benefits to the Student
- Understanding of how programming languages and IDEs are implemented;
- Integration into a prolific research group, fond of software development and programming languages;
- Potential integration as a master and/or PhD student either within the group or within one of its numerous partners around the world (Switzerland, Chile, Belgium, Argentina, Italy).
Benefits to the Community
- Simplify writing new code with traits and help understand trait-based existing code;
- Enable rewriting of non trait-based code with traits to improve its design and reuse;
- Provide a basis to continue research around traits with a better implementation.
 S. Ducasse, O. Nierstrasz, N. Schärli, R. Wuyts, and A. P. Black.
Traits: A Mechanism for fine-grained Reuse. In TOPLAS: ACM Transactions
on Programming Languages and Systems 28(2) p. 331—388, March 2006.
 A. Black, S. Ducasse, O. Nierstrasz, D. Pollet, D. Cassou, and M.
Denker. Pharo by Example, Square Bracket Associates, 2009.
 D. Cassou, S. Ducasse, and R. Wuyts. Traits at Work: the design of
a new trait-based stream library. In Journal of Computer Languages,
Systems and Structures 35(1) p. 2—20, 2009.