Abstract
In software development, it is easy to introduce code smells owing to the complexity of projects and the negligence of programmers. Code smells reduce code comprehensibility and maintainability, making programs error-prone. Hence, code smell detection is extremely important. Recently, machine learning-based technologies turn to be the mainstream detection approaches, which show promising performance. However, existing machine learning methods have two limitations: (1) most studies only focus on common smells, and (2) the proposed metrics are not effective when being used for uncommon code smell detection, e.g., change barrier based code smells. To overcome these limitations, this paper investigates the detection of uncommon change barrier based code smells. We study three typical code smells, i.e., Divergent Change, Shotgun Surgery, and Parallel Inheritance, which all belong to change barriers. We analyze the characteristics of change barriers and extract domain-specific metrics to train a Logistic Regression model for detection. The experimental results show that our method achieves 81.8%–100% precision and recall, outperforming existing algorithms by 10%–30%. In addition, we analyze the correlation and importance of the utilized metrics. We find our domain-specific metrics are important for the detection of change barriers. The results would help practitioners better design detection tools for such code smells.
Similar content being viewed by others
References
Fowler M. Refactoring: Improving the Design of Existing Code. Hoboken: Addison-Wesley Professional, 2018
Fontana F A, Ferme V, Zanoni M, et al. Automatic metric thresholds derivation for code smell detection. In: Proceedings of the 6th International Workshop on Emerging Trends in Software Metrics, Florence, 2015. 44–53
Ouni A, Kessentini M, Inoue K, et al. Search-based web service antipatterns detection. IEEE Trans Serv Comput, 2017, 10: 603–617
Palomba F. Textual analysis for code smell detection. In: Proceedings of the 37th International Conference on Software Engineering-Volume 2, 2015. 769–771
Deng C W, Huang G B, Xu J, et al. Extreme learning machines: new trends and applications. Sci China Inf Sci, 2015, 58: 020301
Zhou Z-H. Abductive learning: towards bridging machine learning and logical reasoning. Sci China Inf Sci, 2019, 62: 076101
Khomh F, Vaucher S, Guéhéneuc Y G, et al. A Bayesian approach for the detection of code and design smells. In: Proceedings of the 9th International Conference on Quality Software, 2009. 305–314
Fontana F A, Mäntylä M V, Zanoni M, et al. Comparing and experimenting machine learning techniques for code smell detection. Empir Softw Eng, 2016, 21: 1143–1191
Kaur A, Jain S, Goel S. A support vector machine based approach for code smell detection. In: Proceedings of International Conference on Machine Learning and Data Science (MLDS), 2017. 9–14
Kreimer J. Adaptive detection of design flaws. Electron Notes Theor Comput Sci, 2005, 141: 117–136
Vaucher S, Khomh F, Moha N, et al. Tracking design smells: lessons from a study of God classes. In: Proceedings of the 16th Working Conference on Reverse Engineering, 2009. 145–154
Linders B. Refactoring and Code Smells — A Journey Toward Cleaner Code. 2016. https://www.infoq.com/news/2016/09/refactoring-code-smells/
Cristina M, Radu M, Mihancea F, et al. iPlasma: an integrated platform for quality assessment of object-oriented design. In: Proceedings of the 21st IEEE International Conference on Software Maintenance, 2005. 77–80
Singh P, Singh H. DynaMetrics: a runtime metric-based analysis tool for object-oriented software systems. SIGSOFT Softw Eng Notes, 2008, 33: 1–6
Eaddy M, Aho A, Murphy G C. Identifying, assigning, and quantifying crosscutting concerns. In: Proceedings of the 1st International Workshop on Assessment of Contemporary Modularization Techniques, 2007. 2
Chidamber S R, Kemerer C F. A metrics suite for object oriented design. IEEE Trans Softw Eng, 1994, 20: 476–493
Padilha J, Pereira J, Figueiredo E, et al. On the effectiveness of concern metrics to detect code smells: an empirical study. In: Proceedings of International Conference on Advanced Information Systems Engineering, 2014. 656–671
Witten I H, Frank E, Hall M A, et al. Data Mining: Practical Machine Learning Tools and Techniques. San Fransisco: Morgan Kaufmann, 2016
Staelin C. Parameter Selection for Support Vector Machines. Hewlett-Packard Company, Technical Report HPL-2002-354R1, 2003
Palomba F, Di Nucci D, Tufano M, et al. Landfill: an open dataset of code smells with public evaluation. In: Proceedings of 2015 IEEE/ACM 12th Working Conference on Mining Software Repositories, 2015. 482–485
Amorim L, Costa E, Antunes N, et al. Experience report: evaluating the effectiveness of decision trees for detecting code smells. In: Proceedings of IEEE 26th International Symposium on Software Reliability Engineering (ISSRE), 2015. 261–269
Reshi J A, Singh S. Predicting software defects through SVM: an empirical approach. 2018. ArXiv: 1803.03220
Soltanifar B, Akbarinasaji S, Caglayan B, et al. Software analytics in practice: a defect prediction model using code smells. In: Proceedings of the 20th International Database Engineering & Applications Symposium, 2016. 148–155
Moha N, Gueheneuc Y G, Duchien L, et al. DECOR: a method for the specification and detection of code and design smells. IEEE Trans Softw Eng, 2010, 36: 20–36
Fokaefs M, Tsantalis N, Chatzigeorgiou A. Jdeodorant: identification and removal of feature envy bad smells. In: Proceedings of 2007 IEEE International Conference on Software Maintenance, 2007. 519–520
Boussaa M, Kessentini W, Kessentini M, et al. Competitive coevolutionary code-smells detection. In: Proceedings of International Symposium on Search Based Software Engineering. Berlin: Springer, 2013. 50–65
Saranya G, Nehemiah H K, Kannan A. Hybrid particle swarm optimisation with mutation for code smell detection. Int J Bio-Inspired Comput, 2018, 12: 186–195
Kessentini M, Kessentini W, Sahraoui H, et al. Design defects detection and correction by example. In: Proceedings of IEEE 19th International Conference on Program Comprehension, 2011. 81–90
Khomh F, Vaucher S, Guéhéneuc Y G, et al. BDTEX: a GQM-based Bayesian approach for the detection of antipatterns. J Syst Softw, 2011, 84: 559–572
Dario D N, Fabio P, Damian A T, et al. Detecting code smells using machine learning techniques: Are we there yet? In: Proceedings of IEEE 25th International Conference on Software Analysis Evolution and Reengineering (SANER), 2018. 612–621
Maneerat N, Muenchaisri P. Bad-smell prediction from software design model using machine learning techniques. In: Proceedings of the 8th International Joint Conference on Computer Science and Software Engineering (JCSSE), 2011. 331–336
Hassaine S, Khomh F, Guéhéneuc Y G, et al. IDS: an immune-inspired approach for the detection of software design smells. In: Proceedings of the 7th International Conference on the Quality of Information and Communications Technology, 2010. 343–348
Acknowledgements
This work was supported by National Key Research and Development Program of China (Grant No. 2018YFB1003900) and in part by National Natural Science Foundation of China (Grant Nos. 61722202, 61772107).
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Lv, T., Ren, Z., Li, X. et al. Toward accurate detection on change barriers. Sci. China Inf. Sci. 64, 132102 (2021). https://doi.org/10.1007/s11432-019-2902-5
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s11432-019-2902-5