|
ABSTRACT
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 as the subtype relationships that must be maintained.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
 |
1
|
|
| |
2
|
|
 |
3
|
|
 |
4
|
|
| |
5
|
|
| |
6
|
RM Fuhrer, F Tip, A Kiezun, J Dolby, M Keller "Efficiently refactoring Java applications to use generic libraries" in: Proc. of ECOOP (2005) 71--96.
|
| |
7
|
|
| |
8
|
T Genssler, B Schulz "Transforming inheritance into composition - A reengineering pattern" in: Pro. of 4th EuroPLoP (1999).
|
| |
9
|
|
| |
10
|
M Grand Patterns in Java 2nd edition (Wiley & Sons 2002).
|
 |
11
|
Franz J. Hauck, Inheritance modeled with explicit bindings: an approach to typed inheritance, Proceedings of the eighth annual conference on Object-oriented programming systems, languages, and applications, p.231-239, September 26-October 01, 1993, Washington, D.C., United States
|
 |
12
|
|
| |
13
|
IntelliJ IDEA (http://www.jetbrains.com).
|
| |
14
|
RE Johnson, B Foote "Designing reusable classes" Journal of Object-Oriented Programming 1:2 (1988) 22--35.
|
| |
15
|
|
| |
16
|
JUnit unit testing framework (http://junit.org).
|
| |
17
|
H Kegel Constraint-basierte Typinferenz für Java 5 (Diplomarbeit, Fakultät für Mathematik und Informatik, Fernuniversität in Hagen 2007).
|
| |
18
|
H Kegel, F Steimann "ITcore: A type inference Package for refactoring tools" in: Workshop on Refactoring Tools @ ECOOP (2007).
|
| |
19
|
|
 |
20
|
|
| |
21
|
|
| |
22
|
|
| |
23
|
|
 |
24
|
Jens Palsberg , Michael I. Schwartzbach, Object-oriented type inference, Conference proceedings on Object-oriented programming systems, languages, and applications, p.146-161, October 06-11, 1991, Phoenix, Arizona, United States
|
| |
25
|
|
 |
26
|
Raymie Stata , John V. Guttag, Modular reasoning in the presence of subclassing, Proceedings of the tenth annual conference on Object-oriented programming systems, languages, and applications, p.200-214, October 15-19, 1995, Austin, Texas, United States
|
| |
27
|
F Steimann "The Infer Type refactoring and its use for interface-based programming" Journal of Object Technology 6:2 (2007) 67--89.
|
 |
28
|
|
 |
29
|
Mirko Streckenbach , Gregor Snelting, Refactoring class hierarchies with KABA, Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, October 24-28, 2004, Vancouver, BC, Canada
|
 |
30
|
Frank Tip , Adam Kiezun , Dirk Bäumer, Refactoring for generalization using type constraints, Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications, October 26-30, 2003, Anaheim, California, USA
|
| |
31
|
F Tip "Refactoring using type constraints" in: Proc. of Static Analysis, 14th International Symposium (2007) 1--17.
|
 |
32
|
David Ungar , Randall B. Smith, Self: The power of simplicity, Conference proceedings on Object-oriented programming systems, languages and applications, p.227-242, October 04-08, 1987, Orlando, Florida, United States
|
CITED BY
|
|
Marko Rosenmüller , Norbert Siegmund , Gunter Saake , Sven Apel, Code generation to support static and dynamic composition of software product lines, Proceedings of the 7th international conference on Generative programming and component engineering, October 19-23, 2008, Nashville, TN, USA
|
REVIEW
"Alexandre Bergel : Reviewer"
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 d
more...
|