Background: Code cloning - copying and reusing pieces of source code - is a common phenomenon in software development in practice. There have been several empirical studies on the effects of cloning, but there are contradictory results regarding the connection of cloning and faults. Objective: Our aim is to clarify the relationship between code clones and faults. In particular, we focus on inconsistent (or type-3) clones in this work. Method: We conducted a case study with TWT GmbH where we detected the code clones in three Java systems, set them into relation to information from issue tracking and version control and interviewed three key developers. Results: Of the type-3 clones, 17 contain faults. Developers modified most of the type-3 clones simultaneously and thereby fixed half of the faults in type-3 clones consistently. Type-2 clones with faults all evolved to fixed type-3 clones. Clone length is only weakly correlated with faultiness. Conclusion: There are indications that the developers in two cases have been aware of clones. It might be a reason for the weak relationship between type-3 clones and faults. Hence, it seems important to keep developers aware of clones, potentially with new tool support. Future studies need to investigate if the rate of faults in type-3 clones justifies using them as cues in defect detection.
@cite_12 is the only study known to us that analysed closed-source systems so far. They investigated four industrial systems from two companies and an academic open-source system for type-3 clones. The researchers showed all type-3 clones, which they considered to be true positives, to the developers of the systems and let them annotate them whether the inconsistency was intentional and it constitutes a fault. They found that 28 G "ode and Koschke @cite_18 investigated the clone genealogies in three open-source systems for changes to clones and unintentional inconsistent changes. They found that 57 inspected the remaining changes manually. They found that only 15 .
@cite_18 @cite_12
2067377566 2399550884 2286236884 2098347799
To study the impact of code clones on software quality, researchers typically carry out their studies based on fine-grained analysis of inconsistent changes at the revision level. As a result, they capture much of the chaotic and experimental nature inherent in any on-going software development process. Analyzing highly fluctuating and short-lived clones is likely to exaggerate the ill effects of inconsistent changes on the quality of the released software product, as perceived by the end user. To gain a broader perspective, we perform an empirical study on the effect of inconsistent changes on software quality at the release level. Based on a case study on three open source software systems, we observe that only 1.02 -4.00 of all clone genealogies introduce software defects at the release level, as opposed to the substantially higher percentages reported by previous studies at the revision level. Our findings suggest that clones do not have a significant impact on the post-release quality of the studied systems, and that the developers are able to effectively manage the evolution of cloned code. It is often claimed that duplicated code, also known as softwareclones, occurs frequently. Different researchers have reported clonerates in the range of 19 and 28 , in extreme cases even 59 forparticular systems. It is not clear, however, whether those systemsare just outliers. In this paper, we analyze about 7,800 open-source projects written inC or C++, summing up to 240 MSLOC, and measure their clone rates. Weuse statistical analysis to estimate the means of clone rates in open-source projects. Based on our findings, we could not confirm the high clone ratesreported in previous studies as expected averages. Except for smallprojects including a few copied and modified files, we found ratherlow clone rates compared to previous studies. For instance, if aminimal clone length of 100 tokens (roughly 16 LOC) is requested, wefound an average rate of duplicated type-2 clones of about 12 . Fortype-1 clones of this length, we found an average clone rate of only1 .However, our results show also that cloning is common. We identifiedonly 20 of the projects to have no type-2 clone of at least 100tokens. And 44 of the projects have at least one type-1 clone of atleast 100 tokens. Despite a decade of active research, there has been a marked lack in clone detection techniques that scale to large repositories for detecting near-miss clones. In this paper, we present a token-based clone detector, SourcererCC, that can detect both exact and near-miss clones from large inter-project repositories using a standard workstation. It exploits an optimized inverted-index to quickly query the potential clones of a given code block. Filtering heuristics based on token ordering are used to significantly reduce the size of the index, the number of code-block comparisons needed to detect the clones, as well as the number of required token-comparisons needed to judge a potential clone. We evaluate the scalability, execution time, recall and precision of SourcererCC, and compare it to four publicly available and state-of-the-art tools. To measure recall, we use two recent benchmarks: (1) a big benchmark of real clones, BigCloneBench, and (2) a Mutation Injection-based framework of thousands of fine-grained artificial clones. We find SourcererCC has both high recall and precision, and is able to scale to a large inter-project repository (25K projects, 250MLOC) using a standard workstation. The new hybrid clone detection tool NICAD combines the strengths and overcomes the limitations of both text-based and AST-based clone detection techniques and exploits novel applications of a source transformation system to yield highly accurate identification of cloned code in software systems. In this paper, we present an in-depth study of near-miss function clones in open source software using NICAD. We examine more than 20 open source C, Java and Cn systems, including the entire Linux Kernel, Apache httpd, J2SDK-Swing and db4o and compare their use of cloned code in several different dimensions, including language, clone size, clone similarity, clone location and clone density both by proportion of cloned functions and lines of cloned code. We manually verify all detected clones and provide a complete catalogue of different clones in an online repository in a variety of formats. These validated results can be used as a cloning reference for these systems and as a benchmark for evaluating other clone detection tools. Copyright © 2009 John Wiley & Sons, Ltd. In this paper we provide an empirical study of function clones in more than 20 open source C, Java and Cn systems of varying kinds and sizes including the entire Linux Kernel, using the new hybrid clone detection method, NICAD. We manually verify all the detected clones and provide a complete catalogue of the different clones in an online repository in a variety of formats. Our studies show that there are a large number of near-miss function clones in those systems. Copyright © 2009 John Wiley & Sons, Ltd.