Skip to main content

Lund University Publications

LUND UNIVERSITY LIBRARIES

Cleaning up copy–paste clones with interactive merging

Narasimhan, Krishna ; Reichenbach, Christoph LU orcid and Lawall, Julia (2018) In Automated Software Engineering 25(3). p.627-673
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... (More)

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.

(Less)
Please use this url to cite or link to this publication:
author
; and
organization
publishing date
type
Contribution to journal
publication status
published
subject
keywords
Clone management, Program analysis, Source code analysis, Static analysis
in
Automated Software Engineering
volume
25
issue
3
pages
627 - 673
publisher
Springer
external identifiers
  • scopus:85049609502
ISSN
0928-8910
DOI
10.1007/s10515-018-0238-5
language
English
LU publication?
yes
id
0e7a34fc-1a9f-46e4-8f34-198cb3fbee52
date added to LUP
2018-07-20 11:31:47
date last changed
2023-02-27 12:48:39
@article{0e7a34fc-1a9f-46e4-8f34-198cb3fbee52,
  abstract     = {{<p>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.</p>}},
  author       = {{Narasimhan, Krishna and Reichenbach, Christoph and Lawall, Julia}},
  issn         = {{0928-8910}},
  keywords     = {{Clone management; Program analysis; Source code analysis; Static analysis}},
  language     = {{eng}},
  number       = {{3}},
  pages        = {{627--673}},
  publisher    = {{Springer}},
  series       = {{Automated Software Engineering}},
  title        = {{Cleaning up copy–paste clones with interactive merging}},
  url          = {{http://dx.doi.org/10.1007/s10515-018-0238-5}},
  doi          = {{10.1007/s10515-018-0238-5}},
  volume       = {{25}},
  year         = {{2018}},
}