当前位置: X-MOL 学术Automat. Softw. Eng. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Cleaning up copy–paste clones with interactive merging
Automated Software Engineering ( IF 3.4 ) Pub Date : 2018-07-09 , DOI: 10.1007/s10515-018-0238-5
Krishna Narasimhan , Christoph Reichenbach , Julia Lawall

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.

中文翻译:

使用交互式合并清理复制粘贴克隆

复制-粘贴-修改是一种软件重用形式,其中开发人员明确地复制源代码。这个重复的源代码相当于一个代码克隆,适用于新的目的。复制粘贴修改在软件开发人员中很流行,但是,经验证据表明它使软件维护复杂化并增加了错误的频率。为了允许开发人员使用复制-粘贴-修改而不必担心这些问题,我们提出了一种通过创建合适的抽象来自动合并相似代码段的方法。由于不同类型的抽象在不同的​​上下文中可能是有益的,我们的方法提供了多种抽象机制,这些机制是基于对流行开源存储库的研究而选择的。为了证明我们的方法的可行性,我们已经为 C++ 设计并实现了一个原型合并工具,并在一些表现出一些变化的代码克隆上对其进行了评估,即,在流行的开源包中,几乎未命中的克隆。我们观察到维护人员发现我们通过算法创建的抽象在很大程度上优于现有的重复代码。
更新日期:2018-07-09
down
wechat
bug