Systematically refactoring inheritance to delegation in java

10 years 3 months ago
Systematically refactoring inheritance to delegation in java
Because of the strong coupling of classes and the proliferation of unneeded class members induced by inheritance, the suggestion to use composition and delegation instead has become commonplace. The presentation of a corresponding refactoring in the literature may lead one to believe that such a transformation is a straightforward undertaking. However, closer analysis reveals that this refactoring is neither always possible, nor does it necessarily achieve its desired effect. We have therefore identified the necessary preconditions and realizable postconditions of the refactoring, and built a tool that can perform it completely automatically. By applying this tool to all subclasses of several open-source projects, we have collected evidence of the applicability of the refactoring and of its capability to deliver on its promises. The refactoring builds on constraint graphs originally developed for type inference to check the preconditions and to compute the necessary delegation as well...
Hannes Kegel, Friedrich Steimann
Added 17 Nov 2009
Updated 09 Dec 2009
Type Conference
Year 2008
Where ICSE
Authors Hannes Kegel, Friedrich Steimann
Comments (0)