Skip to Main content Skip to Navigation
Journal articles

Cleaning up Copy-Paste Clones with Interactive Merging

Abstract : Copy-paste-modify is a form of software reuse in which developers explicitly duplicate source code. This duplicated source code, amounting to a code clone, is adapted for a new purpose. Copy-paste-modify is popular among software developers, however, empirical evidence shows that it complicates software maintenance and increases the frequency of bugs. To allow developers to use copy-paste-modify without having to worry about these concerns , we propose an approach that automatically merges similar pieces of code by creating suitable abstractions. Because different kinds of abstractions may be beneficial in different contexts, our approach offers multiple abstraction mechanisms, which were selected based on a study of popular open-source repositories. To demonstrate the feasibility of our approach, we have designed and implemented a prototype merging tool for C++ and evaluated it on a number of code clones exhibiting some variation, i.e near-miss clones, in popular Open Source packages. We observed that maintainers find our algorithmically created abstractions to be largely preferable to the existing duplicated code.
Document type :
Journal articles
Complete list of metadata

Cited literature [36 references]  Display  Hide  Download
Contributor : Julia Lawall Connect in order to contact the contributor
Submitted on : Sunday, August 5, 2018 - 8:14:50 PM
Last modification on : Wednesday, June 8, 2022 - 12:50:07 PM
Long-term archiving on: : Tuesday, November 6, 2018 - 12:21:12 PM


Files produced by the author(s)



Krishna Narasimhan, Christoph Reichenbach, Julia Lawall. Cleaning up Copy-Paste Clones with Interactive Merging. Automated Software Engineering, Springer Verlag, 2018, 25 (3), pp.627-673. ⟨10.1007/s10515-018-0238-5⟩. ⟨hal-01853896⟩



Record views


Files downloads