loading...
 This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
Seventh European Conference on Software Maintenance and Reengineering (CSMR'03)
The Role of Constructors in the Context of Refactoring Object-Oriented Systems
Benevento, Italy
March 26-March 28
ISBN: 0-7695-1902-4
R. Najjar, University of London
S. Counsell, University of London
G. Loizou, University of London
K. Mannock, University of London
Constructors play an essential role in object-oriented (OO) languages as a means of object creation. Yet, very little empirical evidence exists on constructors, trends in their composition and how they impact comprehension and encapsulation of OO classes. In this paper, we empirically investigate the opportunities, benefits and problems of refactoring class constructors across a sample of classes from five Java systems. The refactoring used, namely, replacing multiple constructors with creation methods, was applied to each of a set of classes containing three or more constructors.
Empirical results showed benefits in terms of removed (duplicated) lines of code across the majority of systems. They also showed the potential for improved class comprehension by the creation of non-constructor methods (as a replacement for constructors) and improved encapsulation of class elements through use of a private catch-all constructor. We also provide evidence from five C++ systems which suggests similar trends in constructors to those found for Java. In terms of problems encountered, frequent and inconsistent use of the super construct made refactoring prohibitively difficult in some cases; the existence of Java interfaces also means a lack of scope for constructor refactoring. The results indicate clear and tangible benefits to be gained from investigation and implementation of refactoring techniques in Java, but with caution being exercised in certain cases; refactoring in practice is not as straightforward as the theory suggests.
Citation:
R. Najjar, S. Counsell, G. Loizou, K. Mannock, "The Role of Constructors in the Context of Refactoring Object-Oriented Systems," csmr, pp.111, Seventh European Conference on Software Maintenance and Reengineering (CSMR'03), 2003
Usage of this product signifies your acceptance of the Terms of Use.