We use a few cookies

Essential cookies keep the library working. With your permission, we'd also like to use analytics to see what's useful and improve the experience. Read our Privacy Policy or Cookie Policy.

Skip to main content
Home/e-Resources/Computer Science & Information Technology/Detection of Code Clone Based on Source Fragment Alignment
PeriodicalsComputer Science & Information Technology

Detection of Code Clone Based on Source Fragment Alignment

Checking your access to this record.

Abstract & Overview

Background: Developers often reuse code segments through copy-paste operation with or without modification during software development which leads to so-called code clone. Code clone brings about some convenience for developers. However, it takes difficulties to the understanding and maintenance of software at the same time. Materials and Methods: A new code clone detection method based on source code alignment is proposed. First, the source code is transformed to token sequences through code preprocessing. Afterwards, the MD5 hash values of each line are calculated in the token sequences. Finally, the candidate code clones are detected based on the calculation of similarity scores of hash sequences. Results: An extensive experiment on 8 open source systems is conducted to measure the precisions and recalls. The results show that the proposed method can detect code clone more effectively than the current methods. Conclusion: The acceleration penalty strategy helps improve the accuracy of code clone detection, because the matched source sequences can be broken into two pairs of more-matched ones if some middle source fragments are not so matched. Additional, following the closed trace-back paths, the proposed method could skip some source fragments, thus further improves its effectiveness.

Cite this record

Jie Wang, Dongjin Yu, Xiang Shu (2017). Detection of Code Clone Based on Source Fragment Alignment. Journal of Software Engineering, 11(3), 266–274. https://doi.org/10.3923/jse.2017.266.274

Copy in another style

Wang, J., Yu, D., & Shu, X. (2017). Detection of Code Clone Based on Source Fragment Alignment. Journal of Software Engineering, 11(3), 266–274. https://doi.org/10.3923/jse.2017.266.274
Author names are used as deposited, so check their order before you submit.

Metadata is harvested from open-access indexes and can be incomplete. Check a citation against the published version before relying on it — see our open access & attribution policy.