Comparative Stability of Cloned and Non-cloned Code: An Empirical Study

Published:

Manishankar Mondal, Chanchal K. Roy, Md Saidur Rahman, Ripon K. Saha, Jens Krinke and Kevin A. Schneider, "Comparative Stability of Cloned and Non-cloned Code: An Empirical Study", 27th ACM Symposium on Applied Computing (ACM SAC) (SE Track), pp. 1227-1234, 2012, Trento, Italy. (Best Paper Award) Preprint Published


Abstract

Code cloning is a controversial software engineering practice due to contradictory claims regarding its effect on software maintenance. Code stability is a recently introduced measurement technique that has been used to determine the impact of code cloning by quantifying the changeability of a code region. Although most of the existing stability analysis studies agree that cloned code is more stable than non-cloned code, the studies have two major flaws: (i) each study only considered a single stability measurement (e.g., lines of code changed, frequency of change, age of change); and, (ii) only a small number of subject systems were analyzed and these were of limited variety.

In this paper, we present a comprehensive empirical study on code stability using three different stability measuring methods. We use a recently introduced hybrid clone detection tool, NiCAD, to detect the clones and analyze their stability in four dimensions: by clone type, by measuring method, by programming language, and by system size and age. Our four-dimensional investigation on 12 diverse subject systems written in three programming languages considering three clone types reveals that: (i) Type-1 and Type-2 clones are unstable, but Type-3 clones are not; (ii) clones in Java and C systems are not as stable as clones in C# systems; (iii) a system’s development strategy might play a key role in defining its comparative code stability scenario; and, (iv) cloned and non-cloned regions of a subject system do not follow a consistent change pattern.