Copy and Paste Redeemed
(2015) p.630-640- Abstract
- Modern software development relies on code reuse, which software engineers typically realise through handwritten abstractions, such as functions, methods, or classes. However, such abstractions can be challenging to develop and maintain. One alternative form of re-use is copy-paste-modify, a methodology in which developers explicitly duplicate source code to adapt the duplicate for a new purpose. We observe that copy-paste-modify can be substantially faster to use than manual abstraction, and past research strongly suggests that it is a popular technique among software developers. We therefore propose that software engineers should forego hand-written abstractions in favour of copying and pasting. However, empirical evidence also shows... (More)
- Modern software development relies on code reuse, which software engineers typically realise through handwritten abstractions, such as functions, methods, or classes. However, such abstractions can be challenging to develop and maintain. One alternative form of re-use is copy-paste-modify, a methodology in which developers explicitly duplicate source code to adapt the duplicate for a new purpose. We observe that copy-paste-modify can be substantially faster to use than manual abstraction, and past research strongly suggests that it is a popular technique among software developers. We therefore propose that software engineers should forego hand-written abstractions in favour of copying and pasting. However, empirical evidence also shows that copy-paste-modify complicates software maintenance and increases the frequency of bugs. To address this concern, we propose a software tool that merges together similar pieces of code and automatically creates suitable abstractions. This allows software developers to get the best of both worlds: custom abstraction together with easy re-use. To demonstrate the feasibility of our approach, we have implemented and evaluated a prototype merging tool for C++ on a number of near-miss clones (clones with some modifications) in popular Open Source packages. We found that maintainers find our algorithmically created abstractions to be largely preferable to existing duplicated code. (Less)
Please use this url to cite or link to this publication:
https://lup.lub.lu.se/record/73f86ea9-b3a2-47e2-81e2-2a22f0c93767
- author
- Narasimhan, Krishna and Reichenbach, Christoph LU
- publishing date
- 2015-11-09
- type
- Chapter in Book/Report/Conference proceeding
- publication status
- published
- subject
- host publication
- 30th IEEE/ACM International Conference on Automated Software Engineering (ASE), 2015
- pages
- 630 - 640
- publisher
- IEEE Computer Society
- external identifiers
-
- scopus:84963839178
- ISBN
- 978-1-5090-0025-8
- DOI
- 10.1109/ASE.2015.39
- language
- English
- LU publication?
- no
- additional info
- ASE Distinguished Paper Award
- id
- 73f86ea9-b3a2-47e2-81e2-2a22f0c93767
- date added to LUP
- 2018-02-15 15:58:18
- date last changed
- 2022-03-02 03:30:42
@inproceedings{73f86ea9-b3a2-47e2-81e2-2a22f0c93767, abstract = {{Modern software development relies on code reuse, which software engineers typically realise through handwritten abstractions, such as functions, methods, or classes. However, such abstractions can be challenging to develop and maintain. One alternative form of re-use is copy-paste-modify, a methodology in which developers explicitly duplicate source code to adapt the duplicate for a new purpose. We observe that copy-paste-modify can be substantially faster to use than manual abstraction, and past research strongly suggests that it is a popular technique among software developers. We therefore propose that software engineers should forego hand-written abstractions in favour of copying and pasting. However, empirical evidence also shows that copy-paste-modify complicates software maintenance and increases the frequency of bugs. To address this concern, we propose a software tool that merges together similar pieces of code and automatically creates suitable abstractions. This allows software developers to get the best of both worlds: custom abstraction together with easy re-use. To demonstrate the feasibility of our approach, we have implemented and evaluated a prototype merging tool for C++ on a number of near-miss clones (clones with some modifications) in popular Open Source packages. We found that maintainers find our algorithmically created abstractions to be largely preferable to existing duplicated code.}}, author = {{Narasimhan, Krishna and Reichenbach, Christoph}}, booktitle = {{30th IEEE/ACM International Conference on Automated Software Engineering (ASE), 2015}}, isbn = {{978-1-5090-0025-8}}, language = {{eng}}, month = {{11}}, pages = {{630--640}}, publisher = {{IEEE Computer Society}}, title = {{Copy and Paste Redeemed}}, url = {{http://dx.doi.org/10.1109/ASE.2015.39}}, doi = {{10.1109/ASE.2015.39}}, year = {{2015}}, }