Abstract
Refactoring is one of the key practices in Extreme Programming and other agile methods. Duplicated code is one of the most pervasive and pungent smells to remove from source code through refactoring. Duplicated code has been largely studied in the literature, and different types of duplications, or “clones”, have been identified. Some studies analyzed in details the problems caused by clones in the code, others outlined also the difficulties in removing clones, and the cases in which it could be better not removing them. The refactoring cost for removing clones can be very high, also due to the different choices on the possible refactoring steps. In this paper, we describe our approach and tool developed with the aim to suggest the best refactorings to remove clones in Java code. Our approach is based on the classification of the clones in terms of their location in a class hierarchy, and allows to choose among a restricted set of refactorings, which are then evaluated using multiple criteria. We provide a validation of the effectiveness of the approach.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Zibran, M.F., Roy, C.K.: The road to software clone management: A survey. Technical Report 2012–03, The Univ. of Saskatchewan, Dept. CS, February 2012
Roy, C.K., Cordy, J.R.: A survey on software clone detection research. Technical Report 2007–541, Sch. Computing, Queen’s Univ., Kingston, Canada, September 2007
Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley Longman Publishing Co. Inc., Boston (1999)
Roy, C.K., Cordy, J.R., Koschke, R.: Comparison and evaluation of code clone detection techniques and tools: A qualitative approach. Science of Computer Programming 74(7), 470–495 (2009). Special Issue on ICPC 2008
Golomingi Koni-N’Sapu, G.: Supremo – a scenario based approach for refactoring duplicated code in object oriented systems. Master’s thesis, Inst. of Computer Science, Faculty of Sciences, Univ. of Bern, June 2001
Roy, C., Cordy, J.: NICAD: accurate detection of near-miss intentional clones using flexible pretty-printing and code normalization. In: Proc. the 16th IEEE Int’l Conf. Program Comprehension (ICPC 2008), pp. 172–181. IEEE CS, Amsterdam (2008)
Tempero, E., Anslow, C., Dietrich, J., Han, T., Li, J., Lumpe, M., Melton, H., Noble, J.: The qualitas corpus: a curated collection of java code for empirical studies. In: Proc. the 17th Asia Pacific Software Eng. Conf., pp. 336–345. IEEE CS, Sydney, December 2010
Rattan, D., Bhatia, R., Singh, M.: Software clone detection: A systematic review. Information and Software Technology 55(7), 1165–1199 (2013)
Giesecke, S.: Clone-based Reengineering für Java auf der Eclipse-Plattform. Diplomarbeit, Carl von Ossietzky Universität Oldenburg, Dept. für Informatik, Abteilung Software Eng., Germany (2003)
Giesecke, S.: Generic modelling of code clones. In: Koschke, R., Merlo, E., Walenstein, A. (eds.) Duplication, Redundancy, and Similarity in Software. Dagstuhl Seminar Proc., vol. 06301. Int’les Begegnungs- und Forschungszentrum für Informatik (IBFI), Germany (2007)
Higo, Y., Kusumoto, S., Inoue, K.: A metric-based approach to identifying refactoring opportunities for merging code clones in a java software system. J. Software Maintenance and Evolution: Research and Practice 20(6), 435–461 (2008)
Arcelli Fontana, F., Zanoni, M., Ranchetti, A., Ranchetti, D.: Software clone detection and refactoring. ISRN Software Eng. 2013, 8 (2013)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer International Publishing Switzerland
About this paper
Cite this paper
Arcelli Fontana, F., Zanoni, M., Zanoni, F. (2015). A Duplicated Code Refactoring Advisor. In: Lassenius, C., Dingsøyr, T., Paasivaara, M. (eds) Agile Processes in Software Engineering and Extreme Programming. XP 2015. Lecture Notes in Business Information Processing, vol 212. Springer, Cham. https://doi.org/10.1007/978-3-319-18612-2_1
Download citation
DOI: https://doi.org/10.1007/978-3-319-18612-2_1
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-18611-5
Online ISBN: 978-3-319-18612-2
eBook Packages: Computer ScienceComputer Science (R0)