Mining implicit design templates for actionable code reuse

In this paper, we propose an approach to detecting project-specific recurring designs in code base and abstracting them into design templates as reuse opportunities. The mined templates allow programmers to make further customization for generating new code. The generated code involves the code skeleton of recurring design as well as the semi-implemented code bodies annotated with comments to remind programmers of necessary modification. We implemented our approach as an Eclipse plugin called MICoDe. We evaluated our approach with a reuse simulation experiment and a user study involving 16 participants. The results of our simulation experiment on 10 open source Java projects show that, to create a new similar feature with a design template, (1) on average 69% of the elements in the template can be reused and (2) on average 60% code of the new feature can be adopted from the template. Our user study further shows that, compared to the participants adopting the copy-paste-modify strategy, the ones using MICoDe are more effective to understand a big design picture and more efficient to accomplish the code reuse task.

[1]  Sven Apel,et al.  Scalable analysis of variable software , 2013, ESEC/FSE 2013.

[2]  Hausi A. Müller,et al.  Rigi: A Visualization Environment for Reverse Engineering , 1997, Proceedings of the (19th) International Conference on Software Engineering.

[3]  Gunter Saake,et al.  Feature-Oriented Software Product Lines , 2013, Springer Berlin Heidelberg.

[4]  Ramakrishnan Srikant,et al.  Fast Algorithms for Mining Association Rules in Large Databases , 1994, VLDB.

[5]  Jack Edmonds,et al.  Maximum matching and a polyhedron with 0,1-vertices , 1965 .

[6]  Elmar Jürgens,et al.  CloneDetective - A workbench for clone detection research , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[7]  Jian Pei,et al.  Mining Frequent Patterns without Candidate Generation: A Frequent-Pattern Tree Approach , 2006, Sixth IEEE International Conference on Data Mining - Workshops (ICDMW'06).

[8]  Alexander Egyed,et al.  Reverse Engineering Feature Models from Programs' Feature Sets , 2011, 2011 18th Working Conference on Reverse Engineering.

[9]  Zhenchang Xing,et al.  Clone-based and interactive recommendation for modifying pasted code , 2015, ESEC/SIGSOFT FSE.

[10]  Stéphane Ducasse,et al.  Polymetric Views - A Lightweight Visual Approach to Reverse Engineering , 2003, IEEE Trans. Software Eng..

[11]  Stan Jarzabek,et al.  Detecting higher-level similarity patterns in programs , 2005, ESEC/FSE-13.

[12]  Zhenchang Xing,et al.  Mining Logical Clones in Software: Revealing High-Level Business and Programming Rules , 2013, 2013 IEEE International Conference on Software Maintenance.

[13]  Yinxing Xue Reengineering legacy software products into software product line based on automatic variability analysis , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[14]  Jun Sun,et al.  Detecting differences across multiple instances of code clones , 2014, ICSE.

[15]  Zhendong Su,et al.  DECKARD: Scalable and Accurate Tree-Based Detection of Code Clones , 2007, 29th International Conference on Software Engineering (ICSE'07).

[16]  Marco Tulio Valente,et al.  A Semi-Automatic Approach for Extracting Software Product Lines , 2012, IEEE Transactions on Software Engineering.

[17]  Jun Sun,et al.  Clonepedia: Summarizing Code Clones by Common Syntactic Context for Software Maintenance , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[18]  Gábor J. Székely,et al.  Hierarchical Clustering via Joint Between-Within Distances: Extending Ward's Minimum Variance Method , 2005, J. Classif..

[19]  Tomasz Imielinski,et al.  Mining association rules between sets of items in large databases , 1993, SIGMOD Conference.

[20]  Emden R. Gansner,et al.  Bunch: a clustering tool for the recovery and maintenance of software system structures , 1999, Proceedings IEEE International Conference on Software Maintenance - 1999 (ICSM'99). 'Software Maintenance for Business Change' (Cat. No.99CB36360).

[21]  Kevin Mobley Reverse Engineering for Software Performance Engineering , 2007, 14th Working Conference on Reverse Engineering (WCRE 2007).

[22]  Alexander Egyed,et al.  Enhancing Clone-and-Own with Systematic Reuse for Developing Software Variants , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[23]  Susan Horwitz,et al.  Using Slicing to Identify Duplication in Source Code , 2001, SAS.

[24]  Shinji Kusumoto,et al.  CCFinder: A Multilinguistic Token-Based Code Clone Detection System for Large Scale Source Code , 2002, IEEE Trans. Software Eng..

[25]  Walter Binder,et al.  Reengineering Standard Java Runtime Systems through Dynamic Bytecode Instrumentation , 2007 .

[26]  Ahmed E. Hassan,et al.  A Framework for Studying Clones In Large Software Systems , 2007, Seventh IEEE International Working Conference on Source Code Analysis and Manipulation (SCAM 2007).

[27]  Miryung Kim,et al.  An ethnographic study of copy and paste programming practices in OOPL , 2004, Proceedings. 2004 International Symposium on Empirical Software Engineering, 2004. ISESE '04..

[28]  Nuno Oliveira,et al.  A perspective on architectural re-engineering , 2015, Sci. Comput. Program..

[29]  Stan Jarzabek,et al.  A Data Mining Approach for Detecting Higher-Level Clones in Software , 2009, IEEE Transactions on Software Engineering.

[30]  M. Golumbic Algorithmic Graph Theory and Perfect Graphs (Annals of Discrete Mathematics, Vol 57) , 2004 .

[31]  Serge Demeyer,et al.  Reverse Engineering on the Mainframe: Lessons Learned from "In Vivo" Research , 2010, IEEE Software.

[32]  Brenda S. Baker,et al.  On finding duplication and near-duplication in large software systems , 1995, Proceedings of 2nd Working Conference on Reverse Engineering.

[33]  Rainer Koschke,et al.  Frequency and risks of changes to clones , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[34]  Mircea Lungu,et al.  Towards reverse engineering software ecosystems , 2008, 2008 IEEE International Conference on Software Maintenance.

[35]  Chanchal K. Roy,et al.  A Survey on Software Clone Detection Research , 2007 .

[36]  Zhenchang Xing,et al.  Incremental and iterative reengineering towards Software Product Line: An industrial case study , 2011, 2011 27th IEEE International Conference on Software Maintenance (ICSM).

[37]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[38]  R. Möhring Algorithmic graph theory and perfect graphs , 1986 .

[39]  Christian Kästner,et al.  Variability Mining: Consistent Semi-automatic Detection of Product-Line Features , 2014, IEEE Transactions on Software Engineering.

[40]  Gunter Saake,et al.  Feature-Oriented Software Product Lines , 2013, Springer Berlin Heidelberg.

[41]  Jacques Klein,et al.  Automating the Extraction of Model-Based Software Product Lines from Model Variants (T) , 2015, 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE).