Choosing between class inheritance and object delegation has been the topic of countless debates in the object-oriented (OO) programming community. This tension is the result of an overloading of the class inheritance mechanism [1]. Opting for a delegation instead of an inheritance gives more control to the programmer over operations that may be invoked, without bloating class interfaces.
Techniques to replace class inheritance with object delegation have already been proposed, however, none of them have been properly formalized and associated to an automatic-code transformation engine. Such a transformation is far from being trivial since many subtleties related to subtyping have to be taken into account. This is discussed in this paper.
Practitioners and researchers interested in the field of class inheritance and behavior composition will find this paper appealing, due to the accuracy of the analysis and reflection. Recently, there has been a resurgence of alternatives to class inheritance, such as mixins [2] and traits [3] that usually imply code migration [4]. It is likely that we will see applications of the results presented in this paper.