Multi-objective code-smells detection using good and bad design examples

Code-smells are identified, in general, by using a set of detection rules. These rules are manually defined to identify the key symptoms that characterize a code-smell using combinations of mainly quantitative (metrics), structural, and/or lexical information. We propose in this work to consider the problem of code-smell detection as a multi-objective problem where examples of code-smells and well-designed code are used to generate detection rules. To this end, we use multi-objective genetic programming (MOGP) to find the best combination of metrics that maximizes the detection of code-smell examples and minimizes the detection of well-designed code examples. We evaluated our proposal on seven large open-source systems and found that, on average, most of the different five code-smell types were detected with an average of 87 % of precision and 92 % of recall. Statistical analysis of our experiments over 51 runs shows that MOGP performed significantly better than state-of-the-art code-smell detectors.

[1]  Michele Marchesi,et al.  Micro Patterns in Agile Software , 2013, XP.

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

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

[4]  Yann-Gaël Guéhéneuc,et al.  SMURF: A SVM-based Incremental Anti-pattern Detection Approach , 2012, 2012 19th Working Conference on Reverse Engineering.

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

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

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

[8]  Maoguo Gong,et al.  Multiobjective Immune Algorithm with Nondominated Neighbor-Based Selection , 2008, Evolutionary Computation.

[9]  Ladan Tahvildari,et al.  A Metric-Based Heuristic Framework to Detect Object-Oriented Design Flaws , 2006, 14th IEEE International Conference on Program Comprehension (ICPC'06).

[10]  Itay Maman,et al.  Micro patterns in Java code , 2005, OOPSLA '05.

[11]  Mika Mäntylä,et al.  Comparing and experimenting machine learning techniques for code smell detection , 2015, Empirical Software Engineering.

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

[13]  Yi Sun,et al.  Some Code Smells Have a Significant but Small Effect on Faults , 2014, TSEM.

[14]  Pierre Poulin,et al.  Visual Detection of Design Anomalies , 2008, 2008 12th European Conference on Software Maintenance and Reengineering.

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

[16]  Brahim Aghezzaf,et al.  Generalized Invexity and Duality in Multiobjective Programming Problems , 2000, J. Glob. Optim..

[17]  Gabriele Bavota,et al.  An experimental investigation on the innate relationship between quality and refactoring , 2015, J. Syst. Softw..

[18]  Ghulam Rasool,et al.  A review of code smell mining techniques , 2015, J. Softw. Evol. Process..

[19]  Kalyanmoy Deb,et al.  Code-Smell Detection as a Bilevel Problem , 2014, TSEM.

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

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

[22]  Jehad Al Dallal Identifying refactoring opportunities in object-oriented code: A systematic literature review , 2015, Inf. Softw. Technol..

[23]  Kalyanmoy Deb,et al.  Multi-objective optimization using evolutionary algorithms , 2001, Wiley-Interscience series in systems and optimization.

[24]  Ivo F. Sbalzariniy,et al.  Multiobjective optimization using evolutionary algorithms , 2000 .

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

[26]  Aiko Fallas Yamashita,et al.  Do code smells reflect important maintainability aspects? , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[27]  Mohamed Wiem Mkaouer,et al.  On the use of many quality attributes for software refactoring: a many-objective search-based software engineering approach , 2016, Empirical Software Engineering.

[28]  Riccardo Poli,et al.  Genetic Programming: An Introduction and Tutorial, with a Survey of Techniques and Applications , 2008, Computational Intelligence: A Compendium.

[29]  Michele Marchesi,et al.  Micro Pattern Fault-Proneness , 2012, 2012 38th Euromicro Conference on Software Engineering and Advanced Applications.

[30]  Jochen Kreimer,et al.  Adaptive Detection of Design Flaws , 2005, LDTA@ETAPS.

[31]  Audris Mockus,et al.  Quantifying the Effect of Code Smells on Maintenance Effort , 2013, IEEE Transactions on Software Engineering.

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

[33]  Claudia A. Marcos,et al.  An approach to prioritize code smells for refactoring , 2014, Automated Software Engineering.

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

[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]  Foutse Khomh,et al.  An Empirical Study of the Impact of Two Antipatterns, Blob and Spaghetti Code, on Program Comprehension , 2011, 2011 15th European Conference on Software Maintenance and Reengineering.

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

[38]  R BasiliVictor,et al.  Detecting defects in object-oriented designs , 1999 .

[39]  Francesca Arcelli Fontana,et al.  Metrics-based detection of micro patterns , 2010, WETSoM '10.

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

[41]  Forrest Shull,et al.  Detecting defects in object-oriented designs: using reading techniques to increase software quality , 1999, OOPSLA '99.

[42]  M. Mäntylä,et al.  Subjective evaluation of software evolvability using code smells: An empirical study , 2006, Empirical Software Engineering.

[43]  Mika Mäntylä,et al.  Empirical software evolvability - code smells and human evaluations , 2010, 2010 IEEE International Conference on Software Maintenance.

[44]  Pierre Poulin,et al.  Visualization-based analysis of quality for large-scale software systems , 2005, ASE.

[45]  Marco Laumanns,et al.  Performance assessment of multiobjective optimizers: an analysis and review , 2003, IEEE Trans. Evol. Comput..

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

[47]  Aiko Fallas Yamashita,et al.  To what extent can maintenance problems be predicted by code smell detection? - An empirical study , 2013, Inf. Softw. Technol..

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

[49]  Miguel Goulão,et al.  Toward the Design Quality Evaluation of Object-Oriented Software Systems , 1995 .

[50]  Suraj C. Kothari,et al.  A Pattern-Based Framework for Software Anomaly Detection , 2004, Software Quality Journal.