Finding the Best Compromise Between Design Quality and Testing Effort During Refactoring

Anti-patterns are poor design choices that hinder code evolution, and understandability. Practitioners perform refactoring, that are semantic-preserving-code transformations, to correct anti-patterns and to improve design quality. However, manual refactoring is a consuming task and a heavy burden for developers who have to struggle to complete their coding tasks and maintain the design quality of the system at the same time. For that reason, researchers and practitioners have proposed several approaches to bring automated support to developers, with solutions that ranges from single anti-patterns correction, to multiobjective solutions. The latter approaches attempted to reduce refactoring effort, or to improve semantic similarity between classes and methods in addition to removing anti-patterns. To the best of our knowledge, none of the previous approaches have considered the impact of refactoring on another important aspect of software development, which is the testing effort. In this paper, we propose a novel search-based multiobjective approach for removing five well-known anti-patterns and minimizing testing effort. To assess the effectiveness of our proposed approach, we implement three different multiobjective metaheuristics (NSGA-II, SPEA2, MOCell) and apply them to a benchmark comprised of four open-source systems. Results show that MOCell is the metaheuristic that provides the best performance.

[1]  Jean-Marc Jézéquel,et al.  Efficient object-oriented integration and regression testing , 2000, IEEE Trans. Reliab..

[2]  Enrique Alba,et al.  Design Issues in a Multiobjective Cellular Genetic Algorithm , 2007, EMO.

[3]  Barry W. Boehm,et al.  What we have learned about fighting defects , 2002, Proceedings Eighth IEEE Symposium on Software Metrics.

[4]  Marouane Kessentini,et al.  Search-Based Refactoring Detection Using Software Metrics Variation , 2013, SSBSE.

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

[6]  Alberto Bacchelli,et al.  On the Impact of Design Flaws on Software Defects , 2010, 2010 10th International Conference on Quality Software.

[7]  Christian Blum,et al.  Metaheuristics in combinatorial optimization: Overview and conceptual comparison , 2003, CSUR.

[8]  Yann-Gaël Guéhéneuc,et al.  DeMIMA: A Multilayered Approach for Design Pattern Identification , 2008, IEEE Transactions on Software Engineering.

[9]  Tsun S. Chow,et al.  Testing Software Design Modeled by Finite-State Machines , 1978, IEEE Transactions on Software Engineering.

[10]  Yves Le Traon,et al.  Measuring design testability of a UML class diagram , 2005, Information and Software Technology.

[11]  William G. Griswold Program restructuring as an aid to software maintenance , 1992 .

[12]  Deepak Goyal,et al.  A hierarchical model for object-oriented design quality assessment , 2015 .

[13]  Boris Beizer,et al.  Rebuttal of the book review by R. Whitty of ‘Software Testing Techniques’ (2nd edn) , 1994, Softw. Test. Verification Reliab..

[14]  Gabriele Bavota,et al.  Detecting bad smells in source code using change history information , 2013, 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE).

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

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

[17]  Mohamed Wiem Mkaouer,et al.  Recommendation system for software refactoring using innovization and interactive dynamic optimization , 2014, ASE.

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

[19]  Arie van Deursen,et al.  An empirical study into class testability , 2006, J. Syst. Softw..

[20]  Anas N. Al-Rabadi,et al.  A comparison of modified reconstructability analysis and Ashenhurst‐Curtis decomposition of Boolean functions , 2004 .

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

[22]  Marco Laumanns,et al.  SPEA2: Improving the strength pareto evolutionary algorithm , 2001 .

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

[24]  Ian C. Parmee,et al.  Interactive, Evolutionary Search in Upstream Object-Oriented Class Design , 2010, IEEE Transactions on Software Engineering.

[25]  Iman Hemati Moghadam,et al.  Code-Imp: a tool for automated search-based refactoring , 2011, WRT '11.

[26]  Tom Mens,et al.  Does God Class Decomposition Affect Comprehensibility? , 2006, IASTED Conf. on Software Engineering.

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

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

[29]  Marcel Urner Testing Object Oriented Software Life Cycle Solutions , 2016 .

[30]  Leon Moonen,et al.  Java quality assurance by detecting code smells , 2002, Ninth Working Conference on Reverse Engineering, 2002. Proceedings..

[31]  Kalyanmoy Deb,et al.  A fast and elitist multiobjective genetic algorithm: NSGA-II , 2002, IEEE Trans. Evol. Comput..

[32]  R. Yin Case Study Research: Design and Methods , 1984 .

[33]  Yann-Gaël Guéhéneuc,et al.  A Study on the Relation between Antipatterns and the Cost of Class Unit Testing , 2013, 2013 17th European Conference on Software Maintenance and Reengineering.

[34]  Mohamed Wiem Mkaouer,et al.  A Robust Multi-objective Approach for Software Refactoring under Uncertainty , 2014, SSBSE.

[35]  Enrique Alba,et al.  MOCell: A cellular genetic algorithm for multiobjective optimization , 2009, Int. J. Intell. Syst..

[36]  Gabriele Bavota,et al.  Do They Really Smell Bad? A Study on Developers' Perception of Bad Code Smells , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

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

[38]  Sarfraz Khurshid,et al.  Korat: automated testing based on Java predicates , 2002, ISSTA '02.

[39]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[40]  Andrzej Jaszkiewicz,et al.  A Comparative Study of Multiple-Objective Metaheuristics on the Bi-Objective Set Covering Problem and the Pareto Memetic Algorithm , 2004, Ann. Oper. Res..

[41]  William F. Opdyke,et al.  Refactoring object-oriented frameworks , 1992 .

[42]  Mark Kent O'Keeffe,et al.  Getting the most from search-based refactoring , 2007, GECCO '07.

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

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

[45]  Mark Harman,et al.  Testability transformation , 2004, IEEE Transactions on Software Engineering.

[46]  Foutse Khomh,et al.  An exploratory study of the impact of antipatterns on class change- and fault-proneness , 2011, Empirical Software Engineering.

[47]  Mark Harman,et al.  Refactoring as Testability Transformation , 2011, 2011 IEEE Fourth International Conference on Software Testing, Verification and Validation Workshops.

[48]  Carl G. Davis,et al.  A Hierarchical Model for Object-Oriented Design Quality Assessment , 2002, IEEE Trans. Software Eng..

[49]  A Straw,et al.  Guide to the Software Engineering Body of Knowledge , 1998 .

[50]  Antonio J. Nebro,et al.  jMetal: A Java framework for multi-objective optimization , 2011, Adv. Eng. Softw..

[51]  Robert V. Binder,et al.  Testing Object-Oriented Systems: Models, Patterns, and Tools , 1999 .

[52]  Lothar Thiele,et al.  Multiobjective evolutionary algorithms: a comparative case study and the strength Pareto approach , 1999, IEEE Trans. Evol. Comput..

[53]  T.C. Lethbridge,et al.  Guide to the Software Engineering Body of Knowledge (SWEBOK) and the Software Engineering Education Knowledge (SEEK) - a preliminary mapping , 2001, 10th International Workshop on Software Technology and Engineering Practice.

[54]  Michael E. Fagan Design and Code Inspections to Reduce Errors in Program Development , 1976, IBM Syst. J..

[55]  Gordon Fraser,et al.  Whole Test Suite Generation , 2013, IEEE Transactions on Software Engineering.

[56]  Foutse Khomh,et al.  Predicting Bugs Using Antipatterns , 2013, 2013 IEEE International Conference on Software Maintenance.

[57]  Miryung Kim,et al.  A field study of refactoring challenges and benefits , 2012, SIGSOFT FSE.

[58]  Serge Demeyer,et al.  Studying the Effect of Refactorings: A Complexity Metrics Perspective , 2010, 2010 Seventh International Conference on the Quality of Information and Communications Technology.

[59]  Mark Kent O'Keeffe,et al.  Search-based software maintenance , 2006, Conference on Software Maintenance and Reengineering (CSMR'06).

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

[61]  Boni García,et al.  SERIOUS: Software Evolution, Refactoring, Improvement of Operational  and Usable Systems , 2009, 2009 13th European Conference on Software Maintenance and Reengineering.

[62]  Phil McMinn,et al.  Evolutionary testing of state-based programs , 2005, GECCO '05.

[63]  Watts S. Humphrey,et al.  Software process improvement at Hughes Aircraft , 1991, IEEE Software.

[64]  Imran Bashir,et al.  Testing object-oriented software - life cycle solutions , 1999 .