Relation of Code Clones and Change Couplings

  • Reto Geiger
  • Beat Fluri
  • Harald C. Gall
  • Martin Pinzger
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3922)

Abstract

Code clones have long been recognized as bad smells in software systems and are considered to cause maintenance problems during evolution. It is broadly assumed that the more clones two files share, the more often they have to be changed together. This relation between clones and change couplings has been postulated but neither demonstrated nor quantified yet. However, given such a relation it would simplify the identification of restructuring candidates and reduce change couplings. In this paper, we examine this relation and discuss if a correlation between code clones and change couplings can be verified. For that, we propose a framework to examine code clones and relate them to change couplings taken from release history analysis. We validated our framework with the open source project Mozilla and the results of the validation show that although the relation is statistically unverifiable it derives a reasonable amount of cases where the relation exists. Therefore, to discover clone candidates for restructuring we additionally propose a set of metrics and a visualization technique. This allows one to spot where a correlation between cloning and change coupling exists and, as a result, which files should be restructured to ease further evolution.

References

  1. 1.
    Fowler, M., Beck, K., Brant, J., Opdyke, W., Roberts, D.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (1999)Google Scholar
  2. 2.
    Mayrand, J., Leblanc, C., Merlo, E.: Experiment on the Automatic Detection of Function Clones in a Software System Using Metrics. In: Proceedings of the International Conference on Software Maintenance (ICSM), pp. 244–253. IEEE CS, Monterey, CA, USA (1996)CrossRefGoogle Scholar
  3. 3.
    Grubb, P., Takang, A.A.: Software Maintenance – Concepts and Practice, 2nd edn. World Scientific, Singapore (2003)MATHCrossRefGoogle Scholar
  4. 4.
    Lehman, M.M., Belady, L.: Program Evolution Processes of Software Change. Academic Press, London (1985)Google Scholar
  5. 5.
    Gall, H., Hajek, K., Jazayeri, M.: Detection of Logical Coupling based on Product Release History. In: Proceedings of the 14th International Conference on Software Maintenance (ICSM), pp. 190–198. IEEE CS, Bethesda, Maryland, USA (1998)Google Scholar
  6. 6.
    Demeyer, S., Ducasse, S., Nierstrasz, O.: Object-Oriented Reengineering Patterns. Morgan Kaufmann, San Francisco, CA, USA (2003)MATHGoogle Scholar
  7. 7.
    Baker, B.S.: A Program for Identifying Duplicated Code. Computing Science and Statistics 24, 49–57 (1992)Google Scholar
  8. 8.
    Ducasse, S., Rieger, M., Demeyer, S.: A Language Independent Approach for Detecting Duplicated Code. In: Proceedings of the 15th International Conference on Software Maintenance (ICSM), pp. 109–118. IEEE CS, Oxford, England, UK (1999)Google Scholar
  9. 9.
    Kamiya, T., Kusumoto, S., Inoue, K.: CCfinder: A Multilinguistic Token-based Code Clone Detection System for Large Scale Source Code. IEEE Transaction on Software Engineering 28, 654–670 (2002)CrossRefGoogle Scholar
  10. 10.
    Baxter, I.D., Yahin, A., Moura, L., Sant’Anna, M., Bier, L.: Clone Detection Using Abstract Syntax Trees. In: Proceedings of the 14th International Conference on Software Maintenance (ICSM), pp. 368–377. IEEE CS, Bethesda, Maryland, USA (1998)Google Scholar
  11. 11.
    Krinke, J.: Identifying Similar Code with Program Dependence Graphs. In: Proceedings of the 8th Working Conference on Reverse Engineering (WCRE), pp. 301–310. IEEE CS, Stuttgart, Germany (2001)CrossRefGoogle Scholar
  12. 12.
    Burd, E., Bailey, J.: Evaluating Clone Detection Tools for Use during Preventative Maintenance. In: Proceedings of the 2nd International Workshop on Source Code Analysis and Manipulation (SCAM), pp. 36–43. IEEE CS, Montreal, Canada (2002)CrossRefGoogle Scholar
  13. 13.
    Ueda, Y., Kamiya, T., Kusumoto, S., Inoue, K.: Gemini: Maintenance Support Environment Based on Code Clone Analysis. In: Proceedings of the 8th International Symposium on Software Metrics (METRICS), pp. 67–76. IEEE CS, Ottawa, Canada (2002)CrossRefGoogle Scholar
  14. 14.
    Rieger, M., Ducasse, S.: Visual Detection of Duplicated Code. In: Workshop on Object-Oriented Technology, pp. 75–76. Springer, Brussels, Belgium (1998)Google Scholar
  15. 15.
    Casazza, G., Antoniol, G., Villano, U., Merlo, E., Penta, M.D.: Identifying Clones in the Linux Kernel. In: Proceedings of the 1sr International Workshop on Source Code Analysis and Manipulation (SCAM), pp. 90–97. IEEE CS, Florence, Italy (2001)CrossRefGoogle Scholar
  16. 16.
    Kim, M., Bergman, L., Lau, T., Notkin, D.: An Ethnographic Study of Copy and Paste Programming Practices in OOPL. In: Proceedings of the International Symposium on Empirical Software Engineering (ISESE), pp. 83–92. IEEE Computer Society Press, Redondo Beach, CA, USA (2004)Google Scholar
  17. 17.
    Lague, B., Proulx, D., Mayrand, J., Merlo, E.M., Hudepohl, J.: Assessing the Benefits of Incorporating Function Clone Detection in a Development Process. In: Proceedings of the 13th International Conference on Software Maintenance (ICSM), pp. 314–323. IEEE CS, Bari, Italy (1997)CrossRefGoogle Scholar
  18. 18.
    Kim, M., Sazawal, V., Notkin, D.: An Empirical Study of Code Clone Genealogies. In: Proceedings of the 10th European software engineering conference held jointly with 13th ACM SIGSOFT international symposium on Foundations of software engineering (ESEC/FSE), pp. 187–196. ACM Press, Lisbon, Protugal (2005)CrossRefGoogle Scholar
  19. 19.
    Kapser, C., Godfrey, M.W.: Aiding Comprehension of Cloning Through Categorization. In: Proceedings of the 7th International Workshop on Principles of Software Evolution (IWPSE), pp. 85–94. IEEE CS, Kyoto, Japan (2004)CrossRefGoogle Scholar
  20. 20.
    Fischer, M., Pinzger, M., Gall, H.: Populating a Release History Database from Version Control and Bug Tracking Systems. In: Proceedings of the 19th International Conference on Software Maintenance (ICSM), pp. 23–32. IEEE CS, Amsterdam, The Netherlands (2003)Google Scholar
  21. 21.
    Gall, H., Jazayeri, M., Krajewski, J.: CVS Release History Data for Detecting Logical Couplings. In: Proceedings of the 6th International Workshop on Principles of Software Evolution (IWPSE), p. 13. IEEE CS, Helsinki, Finland (2003)CrossRefGoogle Scholar
  22. 22.
    Fluri, B., Gall, H.C., Pinzger, M.: Fine-Grained Analysis of Change Couplings. In: Proceedings of the 5th International Workshop on Source Code Analysis and Manipulation, pp. 66–74. IEEE CS, Budapest, Hungary (2005)CrossRefGoogle Scholar
  23. 23.
    Lanza, M., Ducasse, S.: Polymetric Views – A Lightweight Visual Approach to Reverse Engineering. IEEE Transactions on Software Engineering 29, 782–795 (2003)CrossRefGoogle Scholar
  24. 24.
    Geiger, R.: Evolution Impact of Code Clones – Identification of Structural and Change Smells based on Code Clones. Master’s thesis, University of Zurich (2005), http://seal.ifi.unizh.ch/da

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Reto Geiger
    • 1
  • Beat Fluri
    • 1
  • Harald C. Gall
    • 1
  • Martin Pinzger
    • 1
  1. 1.s.e.a.l. – software evolution and architecture lab, Department of InformaticsUniversity of ZurichSwitzerland

Personalised recommendations