ABSTRACT
Code smell targets to identify bugs that occur due to incorrect analysis of code during software development life cycle. It is the task of analyzing a code design problem. The primary causes of code smell are complexity in structural design, violation of programming paradigm, and lack of unit-level testing by the software programmer. Our research focuses on the identification of code smell using different machine learning classifiers. We have considered 15 software code metrics of the Junit open source project and developed a hybrid model for code smell detection. Our dataset consists of 45 features which is further reduced by 15 using various feature selection techniques. Random sampling is used to handle the imbalance in the dataset. The project's performance is evaluated using 10 machine learning techniques which including regression, ensemble methods, and classification. Based on the statistical analysis, it is analyzed that the Random forest ensemble classifiers give best result with an accuracy of 99.12 % is the most appropriate technique for detecting different types of bad smells like god class, duplicate code, long method, large class, and refused bequest.
- Sehgal, R., Mehrotra, D. and Bala, M., 2017. Analysis of code smell to quantify the refactoring. International Journal of System Assurance Engineering and Management, 8(2), pp. 1750--1761.Google Scholar
- Falessi, D., Ahluwalia, A. and Di Penta, M., 2021. The Impact of Dormant Defects on Defect Prediction: a Study of 19 Apache Projects. arXiv preprint arXiv:2105.12372.Google Scholar
- Alkharabsheh, K., Crespo, Y., Manso, E. and Taboada, J.A., 2019. Software Design Smell Detection: a systematic mapping study. Software Quality Journal, 27(3), pp.1069--1148.Google ScholarDigital Library
- Agnihotri, M. and Chug, A., 2020. A systematic literature survey of software metrics, code smells and refactoring techniques. Journal of Information Processing Systems, 16(4), pp.915--934.Google Scholar
- Gupta, H., Kumar, L. and Neti, L.B.M., 2019, March. An Empirical Framework for Code Smell Prediction using Extreme Learning Machine. In 2019 9th Annual Information Technology, Electromechanical Engineering and Microelectronics Conference (IEMECON) (pp. 189--195. IEEE.Google Scholar
- Kumar, L. and Sureka, A., 2017, December. Application of LSSVM and SMOTE on seven open source projects for predicting refactoring at class level. In 2017 24th Asia-Pacific Software Engineering Conference (APSEC) (pp. 90--99. IEEE.Google Scholar
- 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(4), pp.2341--2369.Google ScholarCross Ref
- Karađuzović-Hadžiabdić, K. and Spahić, R., 2018, September. Comparison of machine learning methods for code smell detection using reduced features. In 2018 3rd International Conference on Computer Science and Engineering (UBMK) (pp. 670--672. IEEE.Google Scholar
- Das, A.K., Yadav, S. and Dhal, S., 2019, October. Detecting code smells using deep learning. In TENCON 2019--2019.IEEE Region 10 Conference (TENCON) (pp. 2081--2086. IEEE.Google Scholar
- Di Nucci, D., Palomba, F., Tamburri, D.A., Serebrenik, A. and De Lucia, A., 2018, March. Detecting code smells using machine learning techniques: are we there yet?. In 2018 ieee 25th international conference on software analysis, evolution and reengineering (saner) (pp. 612--621. IEEE.Google Scholar
- Kumar, L., Satapathy, S.M. and Murthy, L.B., 2019, February. Method level refactoring prediction on five open source Java Projects using machine learning techniques. In Proceedings of the 12th Innovations on Software Engineering Conference (formerly known as India Software Engineering Conference) (pp. 1--10..Google Scholar
- Alazba, A. and Aljamaan, H., 2021. Code smell detection using feature selection and stacking ensemble: An empirical investigation. Information and Software Technology, p.106648.Google Scholar
- Patnaik, A., Panigrahi, R. and Padhy, N., 2020, March. Prediction Of Accuracy On Open Source Java Projects Using Class Level Refactoring. In 2020 International Conference on Computer Science, Engineering and Applications (ICCSEA) (pp. 1--6. IEEE.Google Scholar
- Fernandes, E., Chávez, A., Garcia, A., Ferreira, I., Cedrim, D., Sousa, L. and Oizumi, W., 2020. Refactoring effect on internal quality attributes: What haven't they told you yet?. Information and Software Technology, 126, p. 106347.Google ScholarCross Ref
- Guggulothu, T. and Moiz, S.A., 2019. Detection of Shotgun Surgery and Message Chain Code Smells using Machine Learning Techniques. International Journal of Rough Sets and Data Analysis (IJRSDA), 6(2), pp.34--50.Google ScholarCross Ref
- Mansoor, U., Kessentini, M., Bechikh, S. and Deb, K., 2013. Code-smells detection using good and bad software design examples. Technical report, Technical Report.Google Scholar
- Aniche, M., Maziero, E., Durelli, R. and Durelli, V., 2020. The effectiveness of supervised machine learning algorithms in predicting software refactoring. IEEE Transactions on Software Engineering.Google ScholarCross Ref
- 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, pp.115--138.Google ScholarCross Ref
- Pecorelli, F., Di Nucci, D., De Roover, C. and De Lucia, A., 2020. A large empirical assessment of the role of data balancing in machine-learning-based code smell detection. Journal of Systems and Software, 169, p. 110693.Google ScholarCross Ref
- Anwar, H., Pfahl, D. and Srirama, S.N., 2019, August. Evaluating the impact of code smell refactoring on the energy consumption of Android applications. In 2019 45th Euromicro Conference on Software Engineering and Advanced Applications (SEAA) (pp. 82--86. IEEE.Google Scholar
- Abid, C., Alizadeh, V., Kessentini, M., Ferreira, T.D.N. and Dig, D., 2020. 30 years of software refactoring research: a systematic literature review. arXiv preprint arXiv:2007.02194.Google Scholar
- Kaur, G. and Singh, B., 2017, June. Improving the quality of software by refactoring. In 2017 International Conference on Intelligent Computing and Control Systems (ICICCS) (pp. 185--191. IEEE.Google Scholar
- Kaur, S. and Singh, P., 2019. How does object-oriented code refactoring influence software quality? Research landscape and challenges. Journal of Systems and Software, 157, p.110394.Google ScholarCross Ref
- Kaur, I. and Kaur, A., 2021. A Novel Four-Way Approach Designed With Ensemble Feature Selection for Code Smell Detection. IEEE Access, 9, pp.8695--8707.Google ScholarCross Ref
- Malhotra, R. and Lata, K., 2020. Using Ensembles for Class-Imbalance Problem to Predict Maintainability of Open Source Software. International Journal of Reliability, Quality and Safety Engineering, 27(05), p.2040011.Google ScholarCross Ref
- Alotaibi, M., 2018. Advances and Challenges in Software Refactoring: A Tertiary Systematic Literature Review. Rochester Institute of Technology.Google Scholar
- Saika, T., Choi, E., Yoshida, N., Haruna, S. and Inoue, K., 2016, March. Do developers focus on severe code smells?. In 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER) (Vol. 4, pp. 1--3. IEEE.Google Scholar
- Hozano, M., Garcia, A., Fonseca, B. and Costa, E., 2018. Are you smelling it? Investigating how similar developers detect code smells. Information and Software Technology, 93, pp. 130--146.Google ScholarDigital Library
- Patnaik, A. and Padhy, N., 2021. A Hybrid Approach to Identify Code Smell Using Machine Learning Algorithms. International Journal of Open Source Software and Processes (IJOSSP), 12(2), pp.21--35.Google ScholarCross Ref
- Pecorelli, F., Palomba, F., Di Nucci, D. and De Lucia, A., 2019, May. Comparing heuristic and machine learning approaches for metric-based code smell detection. In 2019 IEEE/ACM 27th International Conference on Program Comprehension (ICPC) (pp. 93--104. IEEE.Google Scholar
Index Terms
- Does Code Complexity Affect the Quality of Real-Time Projects?: Detection of Code Smell on Software Projects using Machine Learning Algorithms
Recommendations
Understanding and Detecting Harmful Code
SBES '20: Proceedings of the XXXIV Brazilian Symposium on Software EngineeringCode smells typically indicate poor design implementation and choices that may degrade software quality. Hence, they need to be carefully detected to avoid such poor design. In this context, some studies try to understand the impact of code smells on the ...
An Empirical Study on the Occurrences of Code Smells in Open Source and Industrial Projects
ESEM '22: Proceedings of the 16th ACM / IEEE International Symposium on Empirical Software Engineering and MeasurementBackground: Reusing source code containing code smells can induce significant amount of maintenance time and cost. A list of code smells has been identified in the literature and developers are encouraged to avoid the smells from the very beginning ...
Developers’ perception matters: machine learning to detect developer-sensitive smells
AbstractCode smells are symptoms of poor design that hamper software evolution and maintenance. Hence, code smells should be detected as early as possible to avoid software quality degradation. However, the notion of whether a design and/or implementation ...
Comments