Rule-directed code clone synchronization

Xiao Cheng, Hao Zhong, Yuting Chen, Zhenjiang Hu, Jianjun Zhao

Research output: Chapter in Book/Report/Conference proceedingConference contribution

6 Citations (Scopus)

Abstract

Code clones are prevalent in software systems due to many factors in software development. Detecting code clones and managing consistency between them along code evolution can be very useful for reducing clone-related bugs and maintenance costs. Despite some early attempts at detecting code clones and managing the consistency between them, the state-of-the-art tool can only handle simple code clones whose structures are identical or quite similar. However, existing empirical studies show that clones can have quite different structures with their evolution, which can easily go beyond the capability of the state-of-the-art tool. In this paper, we propose CCSync, a novel, rule-directed approach, which paves the structure differences between the code clones and synchronizes them even when code clones become quite different in their structures. The key steps of this approach are, given two code clones, to (1) extract a synchronization rule from the relationship between the clones, and (2) once one code fragment is updated, propagate the modifications to the other following the synchronization rule. We have implemented a tool for CCSync and evaluated its effectiveness on five Java projects. Our results shows that there are many code clones suitable for synchronization, and our tool achieves precisions of up to 92% and recalls of up to 84%. In particular, more than 76% of our generated revisions are identical with manual revisions.

Original languageEnglish
Title of host publicationProceedings of the 24th IEEE International Conference on Program Comprehension, ICPC 2016 - co-located with ICSE 2016
PublisherIEEE Computer Society
ISBN (Electronic)9781509014286
DOIs
Publication statusPublished - Jul 5 2016
Event24th IEEE International Conference on Program Comprehension, ICPC 2016 - Austin, United States
Duration: May 16 2016May 17 2016

Publication series

NameIEEE International Conference on Program Comprehension
Volume2016-July

Other

Other24th IEEE International Conference on Program Comprehension, ICPC 2016
CountryUnited States
CityAustin
Period5/16/165/17/16

All Science Journal Classification (ASJC) codes

  • Hardware and Architecture
  • Software

Fingerprint Dive into the research topics of 'Rule-directed code clone synchronization'. Together they form a unique fingerprint.

  • Cite this

    Cheng, X., Zhong, H., Chen, Y., Hu, Z., & Zhao, J. (2016). Rule-directed code clone synchronization. In Proceedings of the 24th IEEE International Conference on Program Comprehension, ICPC 2016 - co-located with ICSE 2016 [7503722] (IEEE International Conference on Program Comprehension; Vol. 2016-July). IEEE Computer Society. https://doi.org/10.1109/ICPC.2016.7503722