Skip to main content

Refactoring Structure Semantics Similar Clones Combining Standardization with Metrics

  • Conference paper
  • First Online:
Proceedings of International Conference on Soft Computing Techniques and Engineering Application

Part of the book series: Advances in Intelligent Systems and Computing ((AISC,volume 250))

  • 1633 Accesses

Abstract

Eliminating code clones is good for improving the quality and maintainability of software. Structure semantics similar code clones are more difficult to be refactored than other types of clones. This paper presents an algorithm for refactoring structure semantics similar clones. Structure semantics similar clones are the clones that have similar program dependence graph (PDGs) after semantic equivalent standardization transformation. The graph-based standardization method can identify the semantically similar code clones effectively with a high computation complexity. The metrics-based method has a lower computation complexity but also has a lower accuracy of identification. To solve this problem, this paper first uses the metrics-based method to filter out most candidate clones not suitable for refactoring and then further confirms the structure semantics similar clones that are suitable for refactoring by code standardization, PDGs matching, and similarity comparison. Structure semantics we propose a new approach for refactoring structure semantics similar clones combining standardization with metrics. The experiments results in open source codes show that this method behaves well in refactoring structure semantics similar clones.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 169.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 219.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Kamiya, T., Kusumoto, S., Inoue, K.: CCFinder: a multilinguistic token-based code clone detection system for large scale source code. IEEE Trans. Softw. Eng. 28(7), 654–670 (2002)

    Article  Google Scholar 

  2. Roy, C.K., Cordy, J.R., Koschke, R.: Comparison and evaluation of code clone detection techniques and tools: a qualitative approach. Sci. Comput. Program. 74, 470–495 (2009)

    Article  MATH  MathSciNet  Google Scholar 

  3. Wang, Q.: C Code Clone and Related Software Defect Detection Based on Sequence Mining, pp. 1–47. Harbin Institute of Technology Computer Science and Technology School, Harbin (2009)

    Google Scholar 

  4. Chou, A., Yang, J., Chelf, B., Hallem, S., Engler, D.: An empirical study of operating systems errors. In: Proceedings of the Eighteenth ACM Symposium on Operating systems principles, SOSP’01, pp. 73–88 (2001)

    Google Scholar 

  5. Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison Wesley, Reading (1999)

    Google Scholar 

  6. Wang, T.: The study to identify structure semantics similar programs. Doctoral Dissertation, Harbin Institute of Technology (2009)

    Google Scholar 

  7. Baker, B.S.: On finding duplication and near-duplication in large software systems. In: Working Conference on Reverse Engineering (WCRE), pp. 86–95 (1995)

    Google Scholar 

  8. Baxter, D., Yahin, A., Moura, L., Sant’Anna, M., Bier, L.: Clone detection using abstract syntax trees. In: ICSM, pp. 368–377 (1998)

    Google Scholar 

  9. Jiang, L., Misherghi, G., Su, Z., Glondu, S.: Deckard: scalable and accurate tree-based detection of code clones. In: ICSE, pp. 96–105 (2007)

    Google Scholar 

  10. Kamiya, T., Kusumoto, S., Inoue, K.: CCFinder: a multilinguistic token-based code clone detection system for large scale source code. TSE 28(7), 654–670 (2002)

    Google Scholar 

  11. Kim, H., Jung, Y., Kim, S., Yi, K.: MeCC: memory comparison-based clone detector. In: 33rd International Conference on Software Engineering, ACM, pp. 301–310 (2011)

    Google Scholar 

  12. Jiang, L.: Scalable detection of similar code. Techniques and Applications. Computer 82–119 (2009)

    Google Scholar 

  13. Jiang, L., Su, Z.: Automatic mining of functionally equivalent code fragments via random testing. In: ISSTA ‘09 Proceedings of the Eighteenth International Symposium on Software Testing and Analysis, pp. 81–91 (2009)

    Google Scholar 

  14. Kong, D., Su, X., Wu, S., et al.: Detect functionally equivalent code fragments via K-nearest neighbor algorithm. IEEE 5th International Conference on Advanced Computational Intelligence(ICACI), Oct. 18(20), pp. 94–98. Nanjing, Jiangsu, China (2012)

    Google Scholar 

  15. Balazinska, M., Merlo, E., Dagenais, M., et al.: Advanced clone-analysis to support object-oriented system refactoring In: Proceedings. Seventh Working Conference on Reverse Engineering, pp. 98–107. IEEE (2000)

    Google Scholar 

  16. Higo, Y., Kusumoto, S., Inoue, K.: A metric-based approach to identifying refactoring opportunities for merging code clones in a Java software system. J. Softw. Maintenance Evol. Res. Pract. 20(6), 435–461 (2008)

    Article  Google Scholar 

  17. Schulze, S., Kuhlemann, M., Rosenmüller, M.: Towards a refactoring guideline using code clone classification. In: Proceedings of the 2nd Workshop on Refactoring Tools. ACM, p. 6 (2008)

    Google Scholar 

  18. Feng, J.: Code clone restructuring of c programs via K-nearest neighbor algorithm. Harbin Institute of TechnologyComputer Science and Technology School, Harbin, pp. 1–57 (2011)

    Google Scholar 

  19. Yu, D., Peng, X., Zhao, W.: Automatic refactoring method of cloned code using abstract syntax tree and static analysis. J. Chin. Comput. Syst. 30(9), 1752–1760 (2009)

    Google Scholar 

Download references

Acknowledgments

This research is supported by the National Natural Science Foundation of China (Grant No. 61173021) and the Research Fund for the Doctoral Program of Higher Education of China (Grant Nos. 20112302120052 and 20092302110040).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Xia Li .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer India

About this paper

Cite this paper

Li, X., Su, X., Ma, P., Wang, T. (2014). Refactoring Structure Semantics Similar Clones Combining Standardization with Metrics. In: Patnaik, S., Li, X. (eds) Proceedings of International Conference on Soft Computing Techniques and Engineering Application. Advances in Intelligent Systems and Computing, vol 250. Springer, New Delhi. https://doi.org/10.1007/978-81-322-1695-7_41

Download citation

  • DOI: https://doi.org/10.1007/978-81-322-1695-7_41

  • Published:

  • Publisher Name: Springer, New Delhi

  • Print ISBN: 978-81-322-1694-0

  • Online ISBN: 978-81-322-1695-7

  • eBook Packages: EngineeringEngineering (R0)

Publish with us

Policies and ethics