Advanced Analysis for Code Clone Removal.

Sandro Schulze, Martin Kuhlemann · Softwaretechnik-Trends · 2009

Code cloning, i.e., the process of replicating code fragments by copy-paste(-and-adaption), is common in software development [1]. Although it comes along with some short-term advantages (e.g., timeto-market or reusing functioning code), it has crucial drawbacks in the long run, e.g., increased maintenance costs or inconsistent changes [1]. As a consequence, it is important to be aware of such code clones in the system. To this end, clone detection techniques have been proposed and widely applied [1]. However, the detection of clones is not enough but further processing steps are necessary to overcome or at least minimize the mentioned drawbacks. One approach which aims at a durable elimination of code clones is refactoring [2]. Several approaches exist (e.g., [3, 4]), that differ in the underlying clone detection technique and thus, in the information provided for the refactoring process. However, each of these approaches has one or more of the following problems: • Only some refactorings are provided (mostly Extract Method and Pull Up Method [2]) and thus, a considerable fraction of clones is not covered. • The information passed to the refactorings allows only the removal of coarse-grained clones (e.g., functions) which furthermore have to be of specific types [5]. • All approaches provide an automated, noninteractive refactoring process. This, in turn, can lead to problems in maintainability and understandability of the refactored code. • Only object-oriented refactorings (OOR) are considered, although there may be better approaches for single problems than OOR.

Read the paper · More papers on PaperTik