DocumentCode :
176172
Title :
Recommending Clones for Refactoring Using Design, Context, and History
Author :
Wei Wang ; Godfrey, Michael W.
Author_Institution :
Sch. of Comput. Sci., Univ. of Waterloo, Waterloo, ON, Canada
fYear :
2014
fDate :
Sept. 29 2014-Oct. 3 2014
Firstpage :
331
Lastpage :
340
Abstract :
Developers know that copy-pasting code (aka code cloning) is often a convenient shortcut to achieving a design goal, albeit one that carries risks to the code quality over time. However, deciding which, if any, clones should be eliminated within an existing system is a daunting task. Fixing a clone usually means performing an invasive refactoring, and not all clones may be worth the effort, cost, and risk that such a change entails. Furthermore, sometimes cloning fulfils a useful design role, and should not be refactored at al. And clone detection tools often return very large result sets, making it hard to choose which clones should be investigated and possibly removed. In this paper, we propose an automated approach to recommend clones for refactoring by training a decision tree-based classifier. We analyze more than 600 clone instances in three medium-to large-sized open source projects, and we collect features that are associated with the source code, the context, and the history of clone instances. Our approach achieves a precision of around 80% in recommending clone refactoring instances for each target system, and similarly good precision is achieved in cross-project evaluation. By recommending which clones are appropriate for refactoring, our approach allows for better resource allocation for refactoring itself after obtaining clone detection results, and can thus lead to improved clone management in practice.
Keywords :
decision trees; pattern classification; software maintenance; clone detection; clone instance context; clone instance history; clone management; clone refactoring instances; code cloning; decision tree-based classifier; open source projects; resource allocation; source code; Cloning; Context; Detectors; Feature extraction; History; Software systems; Clone Management; Code Refactoring; Software Clones; Software Recommendation System;
fLanguage :
English
Publisher :
ieee
Conference_Titel :
Software Maintenance and Evolution (ICSME), 2014 IEEE International Conference on
Conference_Location :
Victoria, BC
ISSN :
1063-6773
Type :
conf
DOI :
10.1109/ICSME.2014.55
Filename :
6976099
Link To Document :
بازگشت