Skip to main content

Toward accurate detection on change barriers

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.

This is a preview of subscription content, access via your institution.

References

  1. Fowler M. Refactoring: Improving the Design of Existing Code. Hoboken: Addison-Wesley Professional, 2018

    MATH  Google Scholar 

  2. 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

  3. Ouni A, Kessentini M, Inoue K, et al. Search-based web service antipatterns detection. IEEE Trans Serv Comput, 2017, 10: 603–617

    Article  Google Scholar 

  4. Palomba F. Textual analysis for code smell detection. In: Proceedings of the 37th International Conference on Software Engineering-Volume 2, 2015. 769–771

  5. Deng C W, Huang G B, Xu J, et al. Extreme learning machines: new trends and applications. Sci China Inf Sci, 2015, 58: 020301

    Google Scholar 

  6. Zhou Z-H. Abductive learning: towards bridging machine learning and logical reasoning. Sci China Inf Sci, 2019, 62: 076101

    MathSciNet  Article  Google Scholar 

  7. 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

  8. 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

    Article  Google Scholar 

  9. 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

  10. Kreimer J. Adaptive detection of design flaws. Electron Notes Theor Comput Sci, 2005, 141: 117–136

    Article  Google Scholar 

  11. 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

  12. Linders B. Refactoring and Code Smells — A Journey Toward Cleaner Code. 2016. https://www.infoq.com/news/2016/09/refactoring-code-smells/

  13. 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

  14. Singh P, Singh H. DynaMetrics: a runtime metric-based analysis tool for object-oriented software systems. SIGSOFT Softw Eng Notes, 2008, 33: 1–6

    Article  Google Scholar 

  15. 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

  16. Chidamber S R, Kemerer C F. A metrics suite for object oriented design. IEEE Trans Softw Eng, 1994, 20: 476–493

    Article  Google Scholar 

  17. 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

  18. Witten I H, Frank E, Hall M A, et al. Data Mining: Practical Machine Learning Tools and Techniques. San Fransisco: Morgan Kaufmann, 2016

    Google Scholar 

  19. Staelin C. Parameter Selection for Support Vector Machines. Hewlett-Packard Company, Technical Report HPL-2002-354R1, 2003

  20. 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

  21. 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

  22. Reshi J A, Singh S. Predicting software defects through SVM: an empirical approach. 2018. ArXiv: 1803.03220

  23. 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

  24. 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

    Article  Google Scholar 

  25. 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

  26. 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

    Chapter  Google Scholar 

  27. 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

    Article  Google Scholar 

  28. 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

  29. 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

    Article  Google Scholar 

  30. 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

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

  32. 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

Download references

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

Authors

Corresponding author

Correspondence to Zhilei Ren.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

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

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11432-019-2902-5

Keywords

  • code smells
  • change barrier
  • logical regression
  • machine learning
  • software development