skip to main content
10.1145/3484824.3484911acmotherconferencesArticle/Chapter ViewAbstractPublication PagesdsmlaiConference Proceedingsconference-collections
research-article

Does Code Complexity Affect the Quality of Real-Time Projects?: Detection of Code Smell on Software Projects using Machine Learning Algorithms

Published:13 January 2022Publication History

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.

References

  1. 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 ScholarGoogle Scholar
  2. 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 ScholarGoogle Scholar
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle Scholar
  5. 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 ScholarGoogle Scholar
  6. 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 ScholarGoogle Scholar
  7. 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 ScholarGoogle ScholarCross RefCross Ref
  8. 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 ScholarGoogle Scholar
  9. 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 ScholarGoogle Scholar
  10. 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 ScholarGoogle Scholar
  11. 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 ScholarGoogle Scholar
  12. 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 ScholarGoogle Scholar
  13. 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 ScholarGoogle Scholar
  14. 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 ScholarGoogle ScholarCross RefCross Ref
  15. 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 ScholarGoogle ScholarCross RefCross Ref
  16. 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 ScholarGoogle Scholar
  17. 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 ScholarGoogle ScholarCross RefCross Ref
  18. 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 ScholarGoogle ScholarCross RefCross Ref
  19. 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 ScholarGoogle ScholarCross RefCross Ref
  20. 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 ScholarGoogle Scholar
  21. 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 ScholarGoogle Scholar
  22. 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 ScholarGoogle Scholar
  23. 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 ScholarGoogle ScholarCross RefCross Ref
  24. 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 ScholarGoogle ScholarCross RefCross Ref
  25. 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 ScholarGoogle ScholarCross RefCross Ref
  26. Alotaibi, M., 2018. Advances and Challenges in Software Refactoring: A Tertiary Systematic Literature Review. Rochester Institute of Technology.Google ScholarGoogle Scholar
  27. 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 ScholarGoogle Scholar
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarCross RefCross Ref
  30. 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 ScholarGoogle Scholar

Index Terms

  1. Does Code Complexity Affect the Quality of Real-Time Projects?: Detection of Code Smell on Software Projects using Machine Learning Algorithms
            Index terms have been assigned to the content through auto-classification.

            Recommendations

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in
            • Published in

              cover image ACM Other conferences
              DSMLAI '21': Proceedings of the International Conference on Data Science, Machine Learning and Artificial Intelligence
              August 2021
              415 pages
              ISBN:9781450387637
              DOI:10.1145/3484824

              Copyright © 2021 ACM

              Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 13 January 2022

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-article
              • Research
              • Refereed limited
            • Article Metrics

              • Downloads (Last 12 months)52
              • Downloads (Last 6 weeks)8

              Other Metrics

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader