Similar code detection and elimination for erlang programs

  • Authors:
  • Huiqing Li;Simon Thompson

  • Affiliations:
  • School of Computing, University of Kent, UK;School of Computing, University of Kent, UK

  • Venue:
  • PADL'10 Proceedings of the 12th international conference on Practical Aspects of Declarative Languages
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

A well-known bad code smell in refactoring and software maintenance is duplicated code, that is the existence of code clones, which are code fragments that are identical or similar to one another. Unjustified code clones increase code size, make maintenance and comprehension more difficult, and also indicate design problems such as a lack of encapsulation or abstraction. This paper describes an approach to detecting ‘similar’ code based on the notion of anti-unification, or least-general common abstraction. This mechanism is used for detecting code clones in Erlang programs, and is supplemented by a collection of refactorings to support user-controlled automatic clone removal. The similar code detection algorithm and refactorings are integrated within Wrangler, a tool developed at the University of Kent for interactive refactoring of Erlang programs. We conclude with a report on case studies and comparisons with other tools.