School of Computing

Incremental Code Clone Detection and Elimination for Erlang Programs

Huiqing Li and Simon Thompson

In Dimitra Giannakopoulou and Fernando Orejas, editors, Proceedings of the Conference on Fundamental Approaches to Software Engineering (FASE'11), Lecture Notes in Computer Science, pages 182-196. Springer, March 2011.


A well-known bad code smell in refactoring and software maintenance is the existence of code clones, which are code fragments that are identical or similar to one another. This paper describes an approach to incrementally detecting 'similar' code based on the notion of least-general common abstraction, or anti-unification, as well as a framework for user-controlled incremental elimination of code clones within the context of Erlang programs. The clone detection algorithm proposed in this paper achieves 100% precision, high recall rate, and is user-customisable regarding the granularity of the clone classes reported. By detecting and eliminating clones in an incremental way, we make it possible for the tool to be used in an interactive way even with large codebases. Both the clone detection and elimination functionalities are integrated with Wrangler, a tool for interactive refactoring of Erlang programs. We evaluate the approach with various case studies.

Download publication 418 kbytes (PDF)

Bibtex Record

author = {Huiqing Li and Simon Thompson},
title = {{Incremental Code Clone Detection and Elimination for Erlang Programs}},
month = {March},
year = {2011},
pages = {182-196},
keywords = {determinacy analysis, Craig interpolants},
note = {},
doi = {},
url = {},
    publication_type = {inproceedings},
    submission_id = {23215_1299144069},
    booktitle = {Proceedings of the Conference on Fundamental Approaches to Software Engineering (FASE'11)},
    editor = {Dimitra Giannakopoulou and Fernando Orejas},
    series = {Lecture Notes in Computer Science},
    publisher = {Springer},
    refereed = {yes},

School of Computing, University of Kent, Canterbury, Kent, CT2 7NF

Enquiries: +44 (0)1227 824180 or contact us.

Last Updated: 21/03/2014