|
基于机器学习的缓慢循环异味检测方法
|
Abstract:
随着移动应用的快速发展,代码异味问题日益凸显,严重影响了软件的质量和性能。本文提出了一种基于机器学习的缓慢循环异味检测方法,旨在提高Android应用中代码异味的检测效率和准确性。研究首先构建了一个包含7000个样本的数据集,然后采用决策树(C4.5)、朴素贝叶斯(NB)、逻辑回归(LR)、随机森林(RF)和基于规则的归纳算法(JRip)五种机器学习算法进行缓慢循环异味的检测。实验结果表明,随机森林算法在查准率、查全率和F1值上均表现优异,其次是JRip算法。本研究的方法和结果为Android应用开发中代码异味的自动检测提供了有效的技术支持。
With the rapid development of mobile applications, the issue of code smells has become increasingly prominent, severely affecting the quality and performance of software. This paper proposes a machine learning-based method for detecting slow loop smells, aiming to improve the efficiency and accuracy of detecting code smells in Android applications. The study first constructed a dataset containing 7000 samples, and then used five machine learning algorithms, including Decision Tree (C4.5), Naive Bayes (NB), Logistic Regression (LR), Random Forest (RF), and Rule-based Inductive Algorithm (JRip), to detect slow loop smells. The experimental results show that the Random Forest algorithm performed excellently in terms of precision, recall, and F1 score, followed by the JRip algorithm. The methods and results of this study provide effective technical support for the automatic detection of code smells in the development of Android applications.
[1] | Zhang, Y., Ge, C., Liu, H. and Zheng, K. (2024) Code Smell Detection Based on Supervised Learning Models: A Survey. Neurocomputing, 565, Article ID: 127014. https://doi.org/10.1016/j.neucom.2023.127014 |
[2] | Habchi, S., Rouvoy, R. and Moha, N. (2019) On the Survival of Android Code Smells in the Wild. 2019 IEEE/ACM 6th International Conference on Mobile Software Engineering and Systems (MOBILESoft), Montreal, 25 May 2019, 87-98. https://doi.org/10.1109/mobilesoft.2019.00022 |
[3] | Kaur, S. and Singh, S. (2023) Object Oriented Metrics Based Empirical Model for Predicting “Code Smells” in Open Source Software. Journal of The Institution of Engineers (India): Series B, 104, 241-257. https://doi.org/10.1007/s40031-022-00833-4 |
[4] | Palomba, F., Oliveto, R. and De Lucia, A. (2017) Investigating Code Smell Co-Occurrences Using Association Rule Learning: A Replicated Study. 2017 IEEE Workshop on Machine Learning Techniques for Software Quality Evaluation (MaLTeSQuE), Klagenfurt, 21 February 2017, 8-13. https://doi.org/10.1109/maltesque.2017.7882010 |
[5] | Al-Shaaby, A., Aljamaan, H. and Alshayeb, M. (2020) Bad Smell Detection Using Machine Learning Techniques: A Systematic Literature Review. Arabian Journal for Science and Engineering, 45, 2341-2369. https://doi.org/10.1007/s13369-019-04311-w |
[6] | Azeem, M.I., Palomba, F., Shi, L. and Wang, Q. (2019) Machine Learning Techniques for Code Smell Detection: A Systematic Literature Review and Meta-Analysis. Information and Software Technology, 108, 115-138. https://doi.org/10.1016/j.infsof.2018.12.009 |
[7] | Saborido, R., Morales, R., Khomh, F., Guéhéneuc, Y. and Antoniol, G. (2018) Getting the Most from Map Data Structures in Android. Empirical Software Engineering, 23, 2829-2864. https://doi.org/10.1007/s10664-018-9607-8 |
[8] | 王露颖, 边奕心, 赵松, 等. Android应用程序的代码异味检测工具与方法综述[J]. 智能计算机与应用, 2022, 12(8): 70-75, 84. |
[9] | 田迎晨, 李柯君, 王太明, 等. 代码坏味研究综述[J]. 软件学报, 2023, 34(1): 150-170. |
[10] | Wu, Z., Chen, X. and Lee, S.U. (2023) A Systematic Literature Review on Android-Specific Smells. Journal of Systems and Software, 201, Article ID: 111677. https://doi.org/10.1016/j.jss.2023.111677 |
[11] | Saca, M.A. (2017) Refactoring Improving the Design of Existing Code. 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII), Managua, 15-17 November 2017, 1-3. https://doi.org/10.1109/concapan.2017.8278488 |
[12] | Mannan, U.A., Ahmed, I., Almurshed, R.A.M., Dig, D. and Jensen, C. (2016) Understanding Code Smells in Android Applications. Proceedings of the International Conference on Mobile Software Engineering and Systems, Austin, 14-22 May 2016, 225-234. https://doi.org/10.1145/2897073.2897094 |
[13] | Reimann, J., Brylski, M. and Amann, U. (2014) A Tool-Supported Quality Smell Catalogue for Android Developers. Hefts, 34, 65-76. |
[14] | 边奕心, 李禹齐, 张子恒, 等. 深度学习策略下缓慢循环异味检测方法[J]. 小型微型计算机系统, 2024, 45(2): 490-497. |
[15] | Nucci, D., Palomba, F., Tamburrelli, G., et al. (2018) Detecting Code Smells Using Machine Learning Techniques: Are We There Yet? 2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering (SANER), Campobasso, 20-23 March 2018, 612-621. |