Using Slicing to Identify Duplication in Source Code

Date Added: Jan 2011
Format: PDF

Programs often have a lot of duplicated code, which makes both understanding and maintenance more difficult. This problem can be alleviated by detecting duplicated code, extracting it into a separate new procedure, and replacing all the clones (The instances of the duplicated code) by calls to the new procedure. This paper describes the design and initial implementation of a tool that finds clones and displays them to the programmer. The novel aspect of the approach is the use of program dependence graphs (PDGs) and program slicing to find isomorphic PDG subgraphs that represent clones.