Unification and refactoring of clones

Code duplication has been recognized as a potentially serious problem having a negative impact on the maintain-ability, comprehensibility, and evolution of software systems. In the past, several techniques have been developed for the detection and management of software clones. Existing code duplication can be eliminated by extracting the common functionality into a single module. However, the unification and refactoring of software clones is a challenging problem, since clones usually go through several modifications after their initial introduction. In this paper we present an approach for the unification and refactoring of software clones that overcomes the limitations of previous approaches. More specifically, our approach is able to detect and parameterize non-trivial differences between the clones. Moreover, it can find an optimal mapping between the statements of the clones that minimizes the number of differences. We compared the proposed technique with a competitive clone refactoring tool and concluded that our approach is able to find a significantly larger number of refactorable clones.

[1]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[2]  Joe D. Warren,et al.  The program dependence graph and its use in optimization , 1987, TOPL.

[3]  Susan Horwitz,et al.  Using Slicing to Identify Duplication in Source Code , 2001, SAS.

[4]  J. J. McGregor,et al.  Backtrack search algorithms and the maximal common subgraph problem , 1982, Softw. Pract. Exp..

[5]  Xiaohong Su,et al.  SPAPE: A semantic-preserving amorphous procedure extraction method for near-miss clones , 2013, J. Syst. Softw..

[6]  Alexander Chatzigeorgiou,et al.  Identification of extract method refactoring opportunities for the decomposition of methods , 2011, J. Syst. Softw..

[7]  Nikolaos Tsantalis,et al.  Refactoring Clones: An Optimization Problem , 2013, 2013 IEEE International Conference on Software Maintenance.

[8]  Shinji Kusumoto,et al.  Identifying, Tailoring, and Suggesting Form Template Method Refactoring Opportunities with Program Dependence Graph , 2012, 2012 16th European Conference on Software Maintenance and Reengineering.

[9]  Nikolaos Tsantalis,et al.  Refactoring clones: A new perspective , 2013, 2013 7th International Workshop on Software Clones (IWSC).

[10]  William F. Opdyke,et al.  Refactoring object-oriented frameworks , 1992 .

[11]  R. Koschke,et al.  Frontiers of software clone management , 2008, 2008 Frontiers of Software Maintenance.

[12]  Jeffrey G. Gray,et al.  Increasing clone maintenance support by unifying clone detection and refactoring activities , 2012, Inf. Softw. Technol..

[13]  Chanchal K. Roy,et al.  A Survey on Software Clone Detection Research , 2007 .

[14]  Daniel Speicher,et al.  Clone Removal in Java Programs as a Process of Stepwise Unification , 2013, ArXiv.

[15]  Zhendong Su,et al.  DECKARD: Scalable and Accurate Tree-Based Detection of Code Clones , 2007, 29th International Conference on Software Engineering (ICSE'07).

[16]  Hoan Anh Nguyen,et al.  Clone Management for Evolving Software , 2012, IEEE Transactions on Software Engineering.

[17]  Katsuro Inoue,et al.  How to extract differences from similar programs? A cohesion metric approach , 2013, 2013 7th International Workshop on Software Clones (IWSC).

[18]  Gabriel Valiente,et al.  Algorithms on Trees and Graphs , 2002, Springer Berlin Heidelberg.

[19]  Mark Harman,et al.  Syntax-Directed Amorphous Slicing , 2004, Automated Software Engineering.

[20]  Manishankar Mondal,et al.  An empirical study on clone stability , 2012, SIAP.

[21]  Emily Hill,et al.  Design and Evaluation of an Automated Aspect Mining Tool , 2004, Software Engineering Research and Practice.

[22]  Jens Krinke,et al.  Identifying similar code with program dependence graphs , 2001, Proceedings Eighth Working Conference on Reverse Engineering.

[23]  Rainer Koschke,et al.  An extended assessment of type-3 clones as detected by state-of-the-art tools , 2011, Software Quality Journal.

[24]  Michel Wermelinger,et al.  Assessing the effect of clones on changeability , 2008, 2008 IEEE International Conference on Software Maintenance.

[25]  Shinji Kusumoto,et al.  Code Clone Detection on Specialized PDGs with Heuristics , 2011, 2011 15th European Conference on Software Maintenance and Reengineering.

[26]  Mario Vento,et al.  Challenging Complexity of Maximum Common Subgraph Detection Algorithms: A Performance Analysis of Three Algorithms on a Wide Database of Graphs , 2007, J. Graph Algorithms Appl..

[27]  Shinji Kusumoto,et al.  A metric-based approach to identifying refactoring opportunities for merging code clones in a Java software system , 2008, J. Softw. Maintenance Res. Pract..

[28]  Katsuro Inoue,et al.  Extracting code clones for refactoring using combinations of clone metrics , 2011, IWSC '11.

[29]  Elmar Jürgens,et al.  Do code clones matter? , 2009, 2009 IEEE 31st International Conference on Software Engineering.