Model refactoring using examples: a search‐based approach

One of the important challenges in model‐driven engineering is how to improve the quality of the models' design in order to help designers understand them. Refactoring represents an efficient technique to improve the quality of a design while preserving its behavior. Most of existing work on model refactoring relies on declarative rules to detect refactoring opportunities and to apply the appropriate refactorings. However, a complete specification of refactoring opportunities requires a huge number of rules. In this paper, we consider the refactoring mechanism as a combinatorial optimization problem where the goal is to find good refactoring suggestions starting from a small set of refactoring examples applied to similar contexts. Our approach, named model refactoring by example, takes as input an initial model to refactor, a set of structural metrics calculated on both initial model and models in the base of examples, and a base of refactoring examples extracted from different software systems and generates as output a sequence of refactorings. A solution is defined as a combination of refactoring operations that should maximize as much as possible the structural similarity based on metrics between the initial model and the models in the base of examples. A heuristic method is used to explore the space of possible refactoring solutions. To this end, we used and adapted a genetic algorithm as a global heuristic search. The validation results on different systems of real‐world models taken from open‐source projects confirm the effectiveness of our approach. Copyright © 2014 John Wiley & Sons, Ltd.

[1]  Naouel Moha,et al.  DECOR : Détection et correction des défauts dans les systèmes orientés objet. (DECOR : Detection and Correction of Smells in Object-oriented Systems) , 2008 .

[2]  Dorothea Heiss-Czedik,et al.  An Introduction to Genetic Algorithms. , 1997, Artificial Life.

[3]  Tom Mens,et al.  Analysing refactoring dependencies using graph transformation , 2007, Software & Systems Modeling.

[4]  Lionel C. Briand,et al.  A Hitchhiker's guide to statistical tests for assessing randomized algorithms in software engineering , 2014, Softw. Test. Verification Reliab..

[5]  Jesfis Peral,et al.  Heuristics -- intelligent search strategies for computer problem solving , 1984 .

[6]  Enrico Biermann,et al.  EMF Model Transformation Based on Graph Transformation: Formal Foundation and Tool Environment , 2010, ICGT.

[7]  Shari Lawrence Pfleeger,et al.  Software Metrics : A Rigorous and Practical Approach , 1998 .

[8]  Mario Piattini,et al.  Empirical validation of class diagram metrics , 2002, Proceedings International Symposium on Empirical Software Engineering.

[9]  M.J. Munro,et al.  Product Metrics for Automatic Identification of "Bad Smell" Design Problems in Java Source-Code , 2005, 11th IEEE International Software Metrics Symposium (METRICS'05).

[10]  Jeffrey G. Gray,et al.  Generic and Domain-Specific Model Refactoring Using a Model Transformation Engine , 2005, Model-Driven Software Development.

[11]  Stuart Kent,et al.  Model Driven Engineering , 2002, IFM.

[12]  Marouane Kessentini,et al.  Detecting model refactoring opportunities using heuristic search , 2011, CASCON.

[13]  Yann-Gaël Guéhéneuc,et al.  DECOR: A Method for the Specification and Detection of Code and Design Smells , 2010, IEEE Transactions on Software Engineering.

[14]  Mel Ó Cinnéide,et al.  Journal of Software Maintenance and Evolution: Research and Practice Search-based Refactoring: an Empirical Study , 2022 .

[15]  Grace A. Lewis,et al.  Modernizing Legacy Systems - Software Technologies, Engineering Processes, and Business Practices , 2003, SEI series in software engineering.

[16]  Jan Verelst,et al.  Refactoring - improving coupling and cohesion of existing code , 2004, 11th Working Conference on Reverse Engineering.

[17]  Hafedh Mili,et al.  Detecting Patterns of Poor Design Solutions Using Constraint Propagation , 2008, MoDELS.

[18]  David E. Goldberg,et al.  Genetic Algorithms in Search Optimization and Machine Learning , 1988 .

[19]  Mark Harman,et al.  Pareto optimal search based refactoring at the design level , 2007, GECCO '07.

[20]  Tom Mens,et al.  A survey of software refactoring , 2004, IEEE Transactions on Software Engineering.

[21]  Judea Pearl,et al.  Heuristics : intelligent search strategies for computer problem solving , 1984 .

[22]  Houari A. Sahraoui,et al.  Search-based model transformation by example , 2010, Software & Systems Modeling.

[23]  E. Burton Swanson,et al.  Characteristics of application software maintenance , 1978, CACM.

[24]  Tom Mens,et al.  A formal approach to model refactoring and model refinement , 2007, Software & Systems Modeling.

[25]  Judea Pearl,et al.  Heuristics - intelligent search strategies for computer problem solving , 1984, Addison-Wesley series in artificial intelligence.

[26]  Miryung Kim,et al.  Ref-Finder: a refactoring reconstruction tool based on logic query templates , 2010, FSE '10.

[27]  Houari A. Sahraoui,et al.  Design Defects Detection and Correction by Example , 2011, 2011 IEEE 19th International Conference on Program Comprehension.

[28]  Zhendong Niu,et al.  Facilitating software refactoring with appropriate resolution order of bad smells , 2009, ESEC/FSE '09.

[29]  Radu Marinescu,et al.  Detection strategies: metrics-based rules for detecting design flaws , 2004, 20th IEEE International Conference on Software Maintenance, 2004. Proceedings..

[30]  Derrick G. Kourie,et al.  Towards proving preservation of behaviour of refactoring of UML models , 2005 .

[31]  Johannes Stammel,et al.  Search-based determination of refactorings for improving the class structure of object-oriented systems , 2006, GECCO.

[32]  F. Wilcoxon Individual Comparisons by Ranking Methods , 1945 .

[33]  C. D. Gelatt,et al.  Optimization by Simulated Annealing , 1983, Science.

[34]  William G. Griswold,et al.  Automated support for program refactoring using invariants , 2001, Proceedings IEEE International Conference on Software Maintenance. ICSM 2001.

[35]  John R. Koza,et al.  Genetic programming - on the programming of computers by means of natural selection , 1993, Complex adaptive systems.

[36]  Hafedh Mili,et al.  Understanding design patterns — what is the problem? , 2012, Softw. Pract. Exp..

[37]  Houari A. Sahraoui,et al.  Search-Based Design Defects Detection by Example , 2011, FASE.

[38]  Betty H. C. Cheng,et al.  On the use of genetic programming for automated refactoring and the introduction of design patterns , 2010, GECCO '10.

[39]  Houari A. Sahraoui,et al.  Maintainability defects detection and correction: a multi-objective approach , 2013, Automated Software Engineering.