Skip to main content

Aspectualization of code clones—an algorithmic approach

Abstract

System Modularity has positive effects on software maintainability, reusability, and understandability. One factor that can affect system modularity is code tangling due to code clones. Code tangling can have serious cross-cutting effects on the source code and thereby affect maintainability and reusability of the code. In this research we have developed an algorithmic approach to convert code clones to aspects in order to improve modularity and aid maintainability. Firstly, we use an existing code-clone detection tool to identify code clones in a source code. Secondly, we design algorithms to convert the code clones into aspects and do aspect composition with the original source code. Thirdly, we implement a prototype based on the algorithms. Fourthly, we carry out a performance analysis on the aspects composed source code and our analysis shows that the aspect composed code performs as well as the original code and even better in terms of execution times.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3

References

  1. Ajila, S. A., Petriu, D., Motshegwa, P. (2010). Using model transformation semantics for aspects composition. 2010 IEEE 4th International Conference on Semantic Computing (IEEE-ICSC 2010), 22–24 September 2010 pp. 325–332.

  2. Ajila, S. A., Gakhar, A. S., Lung, C. H., Zaman, M. (2012). Reusing and converting code clones to aspect—an algorithmic approach. The 13th IEEE International Conference on Information Reuse and Integration, Las Vegas, USA August 8–10, 2012.

  3. Baker, B. S. (1995). On finding duplication and near-duplication in large software systems. Proceedings of the 2nd Working Conference on Reverse Engineering, 14–16 Jul 1995 pp. 86–95.

  4. Breu, S., & Krinke, J. (2004). Aspect mining using event traces. Proc. 19th IEEE Int’l Conf. Automated Software Eng. (ASE ’04) (pp. 310–315).

  5. Bruntink, M., van Deursen, A., Tourwe, T. (2005). Isolating idiomatic crosscutting concerns. Proc. IEEE Int’l Conf. Software Maintenance (ICSM ’05).

  6. CCFinder (2012). http://www.ccfinder.net/ccfinderx.html. Last date visited = Jan 30, 2012

  7. France, R., Ray, I., Georg, G., & Ghosh, S. (2004). Aspect-oriented approach to design modeling. IEEE Proceedings—Software, Special Issue on Early Aspects: Aspect –Oriented Requirements Engineering and Architecture Design, 151(4), 173–185.

    Google Scholar 

  8. Johnson, J. H. (1993). Identifying redundancy in source code using fingerprints. Proceedings of the 1993 Conference of the Centre for Advanced Studies on Collaborative Research, CASCON 1993, 1993, pp 171–183.

  9. Juergens, E., Deissenbocck, F., Hummel, B., Wagner, S. (2009). Do code clones matter? IEEE 31st International Conference on Software Engineering, (ICSE’09), May 16–24, 2009 (pp. 485–495), Vancouver.

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

    Article  Google Scholar 

  11. Kasper, C. J. (2009). Toward and understanding of software code cloning as a development practice. PhD. thesis in Computer Science. Waterloo, Ontario, Canada: University of Waterloo.

  12. Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., & Griswold, W. G. (2001). An overview of AspectJ, ECOOP 2001—object-oriented programming. Lecture Notes in Computer Science (LNCS), 2072/2001, 327–353.

    Article  Google Scholar 

  13. Kienzle, J. (2009). Aspect-oriented multi-view modeling. In W. A. Abed & J. Klein (Eds.), Proceedings of the 8th ACM international conference on Aspect-oriented software development, March 2009.

  14. Klein, J., Fleurey, F., & Jézéquel, J. M. (2007). Weaving multiple aspects in sequence diagrams. Transactions on AOSD III, LNCS, 4620, 167–199.

    Google Scholar 

  15. Koschke, R. (2007). Survey of research on software clones. In Proceedings, 06301-duplication, redundancy, and similarity in software, 19th April 2007. URL:http://drops.dagstuhl.de/opus/volltexte/2007/962/.

  16. Krinke, J. (2007). A study of consistent and inconsistent changes to code clones. 14th Working Conference on Reverse Engineering (WCRE 2007), 28–31 October 2007 (pp. 170–178). Vancouver, BC.

  17. Liu, W. L., Lung, C. H., Ajila, S. (2011). Impact of aspect-oriented programming on software performance: A case study of leader/followers and half-sync/half-async architectures. 2011 35th IEEE Annual Computer Software and Applications Conference (COMPSAC), 18–22 July 2011 (pp. 662–667).

  18. Lopez-Herrejon, R., Batory, D., Lengauer, C. (2006). A disciplined approach to aspect composition. Proceedings of the 2006 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation (PEPM ’06), 9–10 January 2006 (pp. 68–77).

  19. Murphy, G. C., Griswold, W. G., Robillard, M. P., Hannemann, J., Leong, W. (2005). Design recommendations for concern elaboration tools. In R. E. Filman et al. (Eds.) Aspect-oriented software development (pp. 507–530).

  20. Petriu, D.C., Shen, H., Sabetta, A. (2007). Performance analysis of aspect- oriented UML models. Software and Systems Modeling (SoSyM), 6(4), 453–471, Springer Berlin / Heidelberg.

    Google Scholar 

  21. Roy, C. K. (2009). Detection and analysis of near-miss software clones. Ph.D. Thesis, Queen’s School of Computing, Queens University, 2009-08-31, 14:05:30.233. http://hdl.handle.net/1974/5104.

  22. Roy, C. K., Cordy, J. R., & Koschke, R. (2009). Comparison and evaluation of code clone detection techniques and tools: a qualitative approach. Science of Computer Programming, 74(7), 470–495.

    Article  Google Scholar 

  23. Schulze, S., Apel, S., Kästner, C. (2010). Code clones in feature-oriented software product lines. Proceedings of the ninth international conference on Generative Programming and Component Engineering GPCE’10, Oct. 10–13, 2010 (pp. 103–112). Eindhoven, The Netherlands.

  24. Shepherd, D., Gibson, E., Pollock, L. L. (2004). Design and evaluation of an automated aspect mining tool. Proc. Int’l Conf. Software Eng. Research and Practice (SERP ’04), 601–607, June 2004.

  25. Tairas, R. A. (2010). Representation, analysis, and refactoring techniques to support code clone maintenance, PhD Thesis. Birmingham, Alabama, USA: University of Alabama.

  26. Walker, R. J., Baniassad, E. L. A., Murphy, G. C. (1999). An initial assessment of aspect-oriented programming. ICSE’99 Proceedings of the 21st international conference on Software Engineering, May 1999, pp. 120–130.

  27. Wand, M., Kiczales, G., & Dutchyn, C. (2004). A semantic for advice and dynamic join points in aspect-oriented programming. ACM Transactions on Programming Languages and Systems, 26(5), 890–910.

    Article  Google Scholar 

  28. Yu, L., & Ramaswamy, S. (2008). Improving modularity by refactoring code clones: a feasibility study on linux. ACM SIGSOFT Software Engineering Notes, 33(2).

  29. Yuan, Y., Guo, Y. (2011). CMCD: Count matrix based code clone detection. 18th Asia Pacific Software Engineering Conference (APSEC-IEEE), 5–8 Dec. 2011, pp. 250–257

Download references

Acknowledgments

This research work was partly supported by Canada NSERC Engage research grant number EGB 410451-10 and partly by Canada NSERC discovery grant number 250271. The testing of the prototype was done in collaboration with Cistel Inc., Ottawa, ON, Canada through the use of their software source code.

Author information

Affiliations

Authors

Corresponding author

Correspondence to Samuel A. Ajila.

Appendices

Appendix A1—CC2ASPECT user interface

figuree

A2—an example of a code clone in PENTRIS

figuref

Appendix B

Tables containing the execution times data. All execution time values are in milliseconds.

Table 9 Execution times of SWEF software system in both experiment rounds
Table 10 Execution times of PENTRIS software system in both experiment rounds

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Ajila, S.A., Gakhar, A.S. & Lung, C. Aspectualization of code clones—an algorithmic approach. Inf Syst Front 16, 835–851 (2014). https://doi.org/10.1007/s10796-013-9428-7

Download citation

Keywords

  • Modularity
  • Code clones
  • Aspects mining
  • Reuse
  • Algorithm
  • Performance analysis