A metric-based approach to identifying refactoring opportunities for merging code clones in a Java software system

  • Authors:
  • Yoshiki Higo;Shinji Kusumoto;Katsuro Inoue

  • Affiliations:
  • Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1-3, Machikaneyama-cho, Toyonaka, Osaka 560-8531, Japan;Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1-3, Machikaneyama-cho, Toyonaka, Osaka 560-8531, Japan;Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1-3, Machikaneyama-cho, Toyonaka, Osaka 560-8531, Japan

  • Venue:
  • Journal of Software Maintenance and Evolution: Research and Practice
  • Year:
  • 2008

Quantified Score

Hi-index 0.01

Visualization

Abstract

A code clone is a code fragment that has other code fragments identical or similar to it in the source code. The presence of code clones is generally regarded as one factor that makes software maintenance more difficult. For example, if a code fragment with code clones is modified, it is necessary to consider whether each of the other code clones has to be modified as well. Removing code clones is one way of avoiding problems that arise due to the presence of code clones. This makes the source code more maintainable and more comprehensible. This paper proposes a set of metrics that suggest how code clones can be refactored. As well, the tool Aries, which automatically computes these metrics, is presented. The tool gives metrics that are indicators for certain refactoring methods rather than suggesting the refactoring methods themselves. The tool performs only lightweight source code analysis; hence, it can be applied to a large number of code lines. This paper also describes a case study that illustrates how this tool can be used. Based on the results of this case study, it can be concluded that this method can efficiently merge code clones. Copyright © 2008 John Wiley & Sons, Ltd.