Developer-Driven Code Smell Prioritization

Code smells are symptoms of poor implementation choices applied during software evolution. While previous research has devoted effort in the definition of automated solutions to detect them, still little is known on how to support developers when prioritizing them. Some works attempted to deliver solutions that can rank smell instances based on their severity, computed on the basis of software metrics. However, this may not be enough since it has been shown that the recommendations provided by current approaches do not take the developer's perception of design issues into account. In this paper, we perform a first step toward the concept of developer-driven code smell prioritization and propose an approach based on machine learning able to rank code smells according to the perceived criticality that developers assign to them. We evaluate our technique in an empirical study to investigate its accuracy and the features that are more relevant for classifying the developer's perception. Finally, we compare our approach with a state-of-the-art technique. Key findings show that the our solution has an F-Measure up to 85% and outperforms the baseline approach.

[1]  Harald C. Gall,et al.  Lightweight Assessment of Test-Case Effectiveness Using Source-Code-Quality Indicators , 2019, IEEE Transactions on Software Engineering.

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

[3]  Andrea De Lucia,et al.  Detecting code smells using machine learning techniques: Are we there yet? , 2018, 2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering (SANER).

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

[5]  A. Ananda Rao,et al.  Detecting Bad Smells in Object Oriented Design Using Design Change Propagation Probability Matrix , 2008 .

[6]  R. Likert “Technique for the Measurement of Attitudes, A” , 2022, The SAGE Encyclopedia of Research Design.

[7]  Francesca Arcelli Fontana,et al.  Toward a Smell-Aware Bug Prediction Model , 2019, IEEE Transactions on Software Engineering.

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

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

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

[11]  Mika Mäntylä,et al.  A taxonomy and an initial empirical study of bad smells in code , 2003, International Conference on Software Maintenance, 2003. ICSM 2003. Proceedings..

[12]  Gabriele Bavota,et al.  On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation , 2018, Empirical Software Engineering.

[13]  Gabriele Bavota,et al.  When and Why Your Code Starts to Smell Bad (and Whether the Smells Go Away) , 2015, IEEE Transactions on Software Engineering.

[14]  Carlos José Pereira de Lucena,et al.  Collaborative Identification of Code Smells: A Multi-Case Study , 2017, 2017 IEEE/ACM 39th International Conference on Software Engineering: Software Engineering in Practice Track (ICSE-SEIP).

[15]  Westley Weimer,et al.  Learning a Metric for Code Readability , 2010, IEEE Transactions on Software Engineering.

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

[17]  Gabriele Bavota,et al.  Mining Version Histories for Detecting Code Smells , 2015, IEEE Transactions on Software Engineering.

[18]  Claude E. Shannon,et al.  Prediction and Entropy of Printed English , 1951 .

[19]  Eleni Stroulia,et al.  Identification and application of Extract Class refactorings in object-oriented systems , 2012, J. Syst. Softw..

[20]  Yuanfang Cai,et al.  Prioritization of Code Anomalies Based on Architecture Sensitiveness , 2013, 2013 27th Brazilian Symposium on Software Engineering.

[21]  R. Kennedy,et al.  Defense Advanced Research Projects Agency (DARPA). Change 1 , 1996 .

[22]  Aiko Fallas Yamashita,et al.  Do developers care about code smells? An exploratory survey , 2013, 2013 20th Working Conference on Reverse Engineering (WCRE).

[23]  Alexander Serebrenik,et al.  Beyond Technical Aspects: How Do Community Smells Influence the Intensity of Code Smells? , 2018, IEEE Transactions on Software Engineering.

[24]  V MäntyläMika,et al.  Comparing and experimenting machine learning techniques for code smell detection , 2016 .

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

[26]  Brian Henderson-Sellers,et al.  Coupling and cohesion (towards a valid metrics suite for object-oriented analysis and design) , 1996, Object Oriented Syst..

[27]  Ken-ichi Matsumoto,et al.  The Impact of Mislabelling on the Performance and Interpretation of Defect Prediction Models , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[28]  David Lorge Parnas,et al.  Software aging , 1994, Proceedings of 16th International Conference on Software Engineering.

[29]  Kalyanmoy Deb,et al.  Multi-objective code-smells detection using good and bad design examples , 2016, Software Quality Journal.

[30]  Jens Dietrich,et al.  Antipattern and Code Smell False Positives: Preliminary Conceptualization and Classification , 2016, 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

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

[32]  Eduardo Figueiredo,et al.  A review-based comparative study of bad smell detection tools , 2016, EASE.

[33]  Ron Kohavi,et al.  Feature Selection for Knowledge Discovery and Data Mining , 1998 .

[34]  Andrea De Lucia,et al.  Improving change prediction models with code smell-related information , 2019, Empirical Software Engineering.

[35]  Yoshua Bengio,et al.  Random Search for Hyper-Parameter Optimization , 2012, J. Mach. Learn. Res..

[36]  Timothy A. Budd,et al.  An introduction to object-oriented programming , 1991 .

[37]  V. Barnett,et al.  Applied Linear Statistical Models , 1975 .

[38]  Sushma Jain,et al.  A Support Vector Machine Based Approach for Code Smell Detection , 2017, 2017 International Conference on Machine Learning and Data Science (MLDS).

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

[40]  Alexander Chatzigeorgiou,et al.  Identification of Move Method Refactoring Opportunities , 2009, IEEE Transactions on Software Engineering.

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

[42]  Ioannis Stamelos,et al.  Code quality analysis in open source software development , 2002, Inf. Syst. J..

[43]  Tracy Hall,et al.  Developing Fault-Prediction Models: What the Research Can Show Industry , 2011, IEEE Software.

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

[45]  A. Scott,et al.  A Cluster Analysis Method for Grouping Means in the Analysis of Variance , 1974 .

[46]  Lech Madeyski,et al.  Which process metrics can significantly improve defect prediction models? An empirical study , 2014, Software Quality Journal.

[47]  Francesca Arcelli Fontana,et al.  Code smell severity classification using machine learning techniques , 2017, Knowl. Based Syst..

[48]  Lin Shi,et al.  Machine learning techniques for code smell detection: A systematic literature review and meta-analysis , 2019, Inf. Softw. Technol..

[49]  William J. Clancey,et al.  Classification Problem Solving , 1984, AAAI.

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

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

[52]  Forrest Shull,et al.  Technical Debt: Showing the Way for Better Transfer of Empirical Results , 2013, Perspectives on the Future of Software Engineering.

[53]  Alexander Chatzigeorgiou,et al.  Ranking Refactoring Suggestions Based on Historical Volatility , 2011, 2011 15th European Conference on Software Maintenance and Reengineering.

[54]  Foutse Khomh,et al.  Do Code Smells Impact the Effort of Different Maintenance Programming Activities? , 2016, 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[55]  Sallie M. Henry,et al.  Maintenance metrics for the object oriented paradigm , 1993, [1993] Proceedings First International Software Metrics Symposium.

[56]  Robert L. Nord,et al.  Managing technical debt in software-reliant systems , 2010, FoSER '10.

[57]  Ron Kohavi,et al.  A Study of Cross-Validation and Bootstrap for Accuracy Estimation and Model Selection , 1995, IJCAI.

[58]  Andrea De Lucia,et al.  Automatic Test Smell Detection Using Information Retrieval Techniques , 2018, 2018 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[59]  J. Ross Quinlan,et al.  Induction of Decision Trees , 1986, Machine Learning.

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

[61]  Davide Taibi,et al.  How developers perceive smells in source code: A replicated study , 2017, Inf. Softw. Technol..

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

[63]  Radu Marinescu,et al.  Assessing technical debt by identifying design flaws in software systems , 2012, IBM J. Res. Dev..

[64]  Cláudio Sant'Anna,et al.  On the Effectiveness of Concern Metrics to Detect Code Smells: An Empirical Study , 2014, CAiSE.

[65]  Andrea De Lucia,et al.  [Journal First] The Scent of a Smell: An Extensive Comparison Between Textual and Structural Smells , 2018, 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE).

[66]  Davide Spadini,et al.  PyDriller: Python framework for mining software repositories , 2018, ESEC/SIGSOFT FSE.

[67]  Michael H. Kutner Applied Linear Statistical Models , 1974 .

[68]  Aaron D. Wyner,et al.  Prediction and Entropy of Printed English , 1993 .

[69]  Stéphane Ducasse,et al.  Yesterday's Weather: guiding early reverse engineering efforts by summarizing the evolution of changes , 2004, 20th IEEE International Conference on Software Maintenance, 2004. Proceedings..

[70]  Marco Tulio Valente,et al.  Why we refactor? confessions of GitHub contributors , 2016, SIGSOFT FSE.

[71]  Harald C. Gall,et al.  Don't touch my code!: examining the effects of ownership on software quality , 2011, ESEC/FSE '11.

[72]  Premkumar T. Devanbu,et al.  How, and why, process metrics are better , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[73]  Andrea De Lucia,et al.  Enhancing change prediction models using developer-related factors , 2018, J. Syst. Softw..

[74]  Andy Zaidman,et al.  How the Experience of Development Teams Relates to Assertion Density of Test Classes , 2019, 2019 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[75]  Andreas Zeller,et al.  Mining metrics to predict component failures , 2006, ICSE.

[76]  Ying Zou,et al.  Towards just-in-time suggestions for log changes , 2016, Empirical Software Engineering.

[77]  Marcelo de Almeida Maia,et al.  A Systematic Literature Review on Bad Smells–5 W's: Which, When, What, Who, Where , 2018, IEEE Transactions on Software Engineering.

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

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

[80]  R. Nickerson Confirmation Bias: A Ubiquitous Phenomenon in Many Guises , 1998 .

[81]  Ian H. Witten,et al.  The WEKA data mining software: an update , 2009, SKDD.

[82]  Andrea De Lucia,et al.  On the role of data balancing for machine learning-based code smell detection , 2019, MaLTeSQuE@ESEC/SIGSOFT FSE.

[83]  Gabriele Bavota,et al.  Anti-Pattern Detection: Methods, Challenges, and Open Issues , 2015, Adv. Comput..

[84]  Harald C. Gall,et al.  A large-scale empirical exploration on refactoring activities in open source software projects , 2019, Sci. Comput. Program..

[85]  Cor-Paul Bezemer,et al.  Examining the Stability of Logging Statements , 2016, 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[86]  Andrea De Lucia,et al.  A textual-based technique for Smell Detection , 2016, 2016 IEEE 24th International Conference on Program Comprehension (ICPC).

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

[88]  Denys Poshyvanyk,et al.  The conceptual cohesion of classes , 2005, 21st IEEE International Conference on Software Maintenance (ICSM'05).

[89]  Gabriele Bavota,et al.  A large-scale empirical study on the lifecycle of code smell co-occurrences , 2018, Inf. Softw. Technol..

[90]  Alexander Serebrenik,et al.  Poster: How Do Community Smells Influence Code Smells? , 2018, 2018 IEEE/ACM 40th International Conference on Software Engineering: Companion (ICSE-Companion).

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

[92]  Andrea De Lucia,et al.  Comparing Heuristic and Machine Learning Approaches for Metric-Based Code Smell Detection , 2019, 2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC).

[93]  Ahmed E. Hassan,et al.  Predicting faults using the complexity of code changes , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[94]  R. Grissom,et al.  Effect sizes for research: A broad practical approach. , 2005 .

[95]  Gabriele Bavota,et al.  A Developer Centered Bug Prediction Model , 2018, IEEE Transactions on Software Engineering.

[96]  Shane McIntosh,et al.  An Empirical Comparison of Model Validation Techniques for Defect Prediction Models , 2017, IEEE Transactions on Software Engineering.