Prioritizing code-smells correction tasks using chemical reaction optimization

The presence of code-smells increases significantly the cost of maintenance of systems and makes them difficult to change and evolve. To remove code-smells, refactoring operations are used to improve the design of a system by changing its internal structure without altering the external behavior. In large-scale systems, the number of code-smells to fix can be very large and not all of them can be fixed automatically. Thus, the prioritization of the list of code-smells is required based on different criteria such as the risk and importance of classes. However, most of the existing refactoring approaches treat the code-smells to fix with the same importance. In this paper, we propose an approach based on a chemical reaction optimization metaheuristic search to find the suitable refactoring solutions (i.e., sequence of refactoring operations) that maximize the number of fixed riskiest code-smells according to the maintainer’s preferences/criteria. We evaluate our approach on five medium- and large-sized open-source systems and seven types of code-smells. Our experimental results show the effectiveness of our approach compared to other existing approaches and three different others metaheuristic searches.

[1]  Chris F. Kemerer,et al.  A Metrics Suite for Object Oriented Design , 2015, IEEE Trans. Software Eng..

[2]  Houari A. Sahraoui,et al.  Deviance from perfection is a better criterion than closeness to evil when identifying risky code , 2010, ASE.

[3]  Phil McMinn,et al.  Search‐based software test data generation: a survey , 2004, Softw. Test. Verification Reliab..

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

[5]  Thomas J. Mowbray,et al.  AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis , 1998 .

[6]  El-Ghazali Talbi,et al.  Hybridizing exact methods and metaheuristics: A taxonomy , 2009, Eur. J. Oper. Res..

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

[8]  Mark Harman,et al.  Evolving transformation sequences using genetic algorithms , 2004, Source Code Analysis and Manipulation, Fourth IEEE International Workshop on.

[9]  Hürevren Kiliç,et al.  Search-Based Parallel Refactoring Using Population-Based Direct Approaches , 2011, SSBSE.

[10]  Yuanyuan Zhang,et al.  Search-based software engineering: Trends, techniques and applications , 2012, CSUR.

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

[12]  Houari A. Sahraoui,et al.  Détection d'anomalies utilisant un langage de règle de qualité , 2006, LMO.

[13]  Mel O Cinn eide Automated application of design patterns: a refactoring approach , 2001 .

[14]  Ladan Tahvildari,et al.  A metric-based approach to enhance design quality through meta-pattern transformations , 2003, Seventh European Conference onSoftware Maintenance and Reengineering, 2003. Proceedings..

[15]  Foutse Khomh,et al.  An Exploratory Study of the Impact of Code Smells on Software Change-proneness , 2009, 2009 16th Working Conference on Reverse Engineering.

[16]  Don Roberts,et al.  Practical analysis for refactoring , 1999 .

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

[18]  Victor O. K. Li,et al.  Real-Coded Chemical Reaction Optimization , 2012, IEEE Transactions on Evolutionary Computation.

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

[20]  Laurie J. Hendren,et al.  Optimizing Java Bytecode Using the Soot Framework: Is It Feasible? , 2000, CC.

[21]  Victor O. K. Li,et al.  Chemical-Reaction-Inspired Metaheuristic for Optimization , 2010, IEEE Transactions on Evolutionary Computation.

[22]  Maria Luisa Villani,et al.  An approach for QoS-aware service composition based on genetic algorithms , 2005, GECCO '05.

[23]  Foutse Khomh,et al.  A Bayesian Approach for the Detection of Code and Design Smells , 2009, 2009 Ninth International Conference on Quality Software.

[24]  Yann-Gaël Guéhéneuc,et al.  Refactorings of Design Defects Using Relational Concept Analysis , 2008, ICFCA.

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

[26]  Miryung Kim,et al.  Template-based reconstruction of complex refactorings , 2010, 2010 IEEE International Conference on Software Maintenance.

[27]  Colin G. Johnson,et al.  Refactoring in Automatically Generated Programs , 2010 .

[28]  Stéphane Ducasse,et al.  Using history information to improve design flaws detection , 2004, Eighth European Conference on Software Maintenance and Reengineering, 2004. CSMR 2004. Proceedings..

[29]  Alexander Chatzigeorgiou,et al.  JDeodorant: Identification and Removal of Type-Checking Bad Smells , 2008, 2008 12th European Conference on Software Maintenance and Reengineering.

[30]  Shari Lawrence Pfleeger,et al.  Software metrics (2nd ed.): a rigorous and practical approach , 1997 .

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

[32]  Mark Harman,et al.  Search-based software engineering , 2001, Inf. Softw. Technol..

[33]  Houari A. Sahraoui,et al.  Search-Based Refactoring Using Recorded Code Changes , 2013, 2013 17th European Conference on Software Maintenance and Reengineering.

[34]  Mark Harman,et al.  Evolving transformation sequences using genetic algorithms , 2004 .

[35]  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.

[36]  P. Lachenbruch Statistical Power Analysis for the Behavioral Sciences (2nd ed.) , 1989 .

[37]  Rushikesh K. Joshi,et al.  Concept Analysis for Class Cohesion , 2009, 2009 13th European Conference on Software Maintenance and Reengineering.

[38]  Enrique Alba,et al.  Management of Software Projects with GAs , 2005 .

[39]  Daniela Cruzes,et al.  The evolution and impact of code smells: A case study of two open source systems , 2009, 2009 3rd International Symposium on Empirical Software Engineering and Measurement.

[40]  Gregorio Robles,et al.  Executable source code and non-executable source code: analysis and relationships , 2004 .

[41]  Mark Harman,et al.  The Current State and Future of Search Based Software Engineering , 2007, Future of Software Engineering (FOSE '07).

[42]  Jerffeson Teixeira de Souza,et al.  Ten Years of Search Based Software Engineering: A Bibliometric Analysis , 2011, SSBSE.

[43]  Gordon Fraser,et al.  Handling test length bloat , 2013, Softw. Test. Verification Reliab..

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

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

[46]  Daniela Cruzes,et al.  Are all code smells harmful? A study of God Classes and Brain Classes in the evolution of three open source systems , 2010, 2010 IEEE International Conference on Software Maintenance.

[47]  Zhao Wei,et al.  Chemical Reaction Optimization for the Fuzzy Rule learning problem , 2012, 2012 IEEE Congress on Evolutionary Computation.

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

[49]  Jin Xu,et al.  Chemical Reaction Optimization for the optimal power flow problem , 2012, 2012 IEEE Congress on Evolutionary Computation.

[50]  P. Cederqvist,et al.  Version Management with CVS , 1993 .

[51]  L. Erlikh,et al.  Leveraging legacy system dollars for e-business , 2000 .

[52]  Reiko Heckel,et al.  Local Search-Based Refactoring as Graph Transformation , 2009, 2009 1st International Symposium on Search Based Software Engineering.

[53]  Jin Xu,et al.  On the Convergence of Chemical Reaction Optimization for Combinatorial Optimization , 2013, IEEE Transactions on Evolutionary Computation.

[54]  Arthur J. Riel,et al.  Object-Oriented Design Heuristics , 1996 .

[55]  Mark Harman,et al.  Experimental assessment of software metrics using automated refactoring , 2012, Proceedings of the 2012 ACM-IEEE International Symposium on Empirical Software Engineering and Measurement.

[56]  Yuanyuan Zhang,et al.  Search Based Requirements Optimisation: Existing Work and Challenges , 2008, REFSQ.

[57]  Houari A. Sahraoui,et al.  Search-based refactoring: Towards semantics preservation , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[58]  Claire Le Goues,et al.  GenProg: A Generic Method for Automatic Software Repair , 2012, IEEE Transactions on Software Engineering.

[59]  Victor O. K. Li,et al.  Real-coded chemical reaction optimization with different perturbation functions , 2012, 2012 IEEE Congress on Evolutionary Computation.

[60]  Mark Kent O'Keeffe,et al.  Search-based refactoring for software maintenance , 2008, J. Syst. Softw..

[61]  Jacob Cohen Statistical Power Analysis for the Behavioral Sciences , 1969, The SAGE Encyclopedia of Research Design.

[62]  Lionel C. Briand,et al.  A practical guide for using statistical tests to assess randomized algorithms in software engineering , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[63]  Riccardo Poli,et al.  Particle swarm optimization , 1995, Swarm Intelligence.

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

[65]  Robert C. Martin Clean Code - a Handbook of Agile Software Craftsmanship , 2008 .

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

[67]  Houari A. Sahraoui,et al.  Can metrics help to bridge the gap between the improvement of OO design quality and its automation? , 2000, Proceedings 2000 International Conference on Software Maintenance.

[68]  Martin Fowler,et al.  Refactoring - Improving the Design of Existing Code , 1999, Addison Wesley object technology series.

[69]  Jin Xu,et al.  Chemical Reaction Optimization for Task Scheduling in Grid Computing , 2011, IEEE Transactions on Parallel and Distributed Systems.

[70]  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).