Historical perspective of code clone refactorings in evolving software

PLoS One. 2022 Dec 1;17(12):e0277216. doi: 10.1371/journal.pone.0277216. eCollection 2022.

Abstract

Cloning in software is generally perceived as a threat to its maintenance and that is why it needs to be managed properly. Understanding clones from a historical perspective is essential for effective clone management. Analysis of code refactorings performed on clones in previous releases will help developers in taking decisions about clone refactoring in future releases. In this paper we perform a longitudinal study on the evolution of clone refactorings in various versions of five software systems. To perform a systematic study on clone refactoring evolution, we define clone evolution patterns for studying refactorings in a formal notation. Our results show that only a small proportion of code clones are refactored between the versions and most of the refactorings are inconsistent within clone classes. Moreover, clone refactorings may cause clone removal. Analysis of the source code of refactored clones reveals similar reasons of inconsistent refactorings and clone removal for five Java systems. This analysis will help in devising appropriate strategies for managing clone refactorings in software and hence provide foundation for devising better clone management tools.

Publication types

  • Research Support, Non-U.S. Gov't

MeSH terms

  • Clonal Evolution*
  • Clone Cells
  • Longitudinal Studies
  • Software*

Grants and funding

This study was funded by Prince Sultan University, Riyadh, Saudi Arabia and Higher Education Commision, Pakistan.