Skip to main content

Software Defect Prediction Using Bad Code Smells: A Systematic Literature Review

  • Chapter
  • First Online:
Data-Centric Business and Applications

Abstract

The challenge of effective refactoring in the software development cycle brought forward the need to develop automated defect prediction models. Among many existing indicators of bad code, code smells have attracted particular interest of both the research community and practitioners in recent years. In this paper, we describe the current state-of-the-art in the field of bug prediction with the use of code smells and attempt to identify areas requiring further research. To achieve this goal, we conducted a systematic literature review of 27 research papers published between 2006 and 2019. For each paper, we (i) analysed the reported relationship between smelliness and bugginess, as well as (ii) evaluated the performance of code smell data used as a defect predictor in models developed using machine learning techniques. Our investigation confirms that code smells are both positively correlated with software defects and can positively influence the performance of fault detection models. However, not all types of smells and smell-related metrics are equally useful. God Class, God Method, Message Chains smells and Smell intensity metric stand out as particularly effective. Smells such as Inappropriate Intimacy, Variable Re-assign, Clones, Middle Man or Speculative Generality require further research to confirm their contribution. Metrics describing the introduction and evolution of anti-patterns in code present a promising opportunity for experimentation.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://ieeexplore.ieee.org/Xplore/home.jsp.

Papers analysed in the systematic literature review

  1. Aman H (2012) An empirical analysis on fault-proneness of well-commented modules. In: Proceedings - 2012 4th international workshop on empirical software engineering in practice, IWESEP 2012, pp 3–9. https://doi.org/10.1109/IWESEP.2012.12

  2. Aman H, Amasaki S, Sasaki T, Kawahara M (2014) Empirical analysis of fault-proneness in methods by focusing on their comment lines. In: Proceedings—Asia-pacific software engineering conference, APSEC. https://doi.org/10.1109/APSEC.2014.93

  3. Aman H, Amasaki S, Sasaki T, Kawahara M (2015) Lines of comments as a noteworthy metric for analyzing fault-proneness in methods. IEICE Trans Inf Syst. https://doi.org/10.1587/transinf.2015EDP7107

    Article  Google Scholar 

  4. Bán D, Ferenc R (2014) Recognizing antipatterns and analyzing their effects on software maintainability, vol 8583 LNCS. https://doi.org/10.1007/978-3-319-09156-3_25

    Chapter  Google Scholar 

  5. D’Ambros M, Bacchelli A, Lanza M (2010) On the impact of design flaws on software defects. In: Proceedings - international conference on quality software 1:23–31. https://doi.org/10.1109/QSIC.2010.58

  6. Hall T, Zhang M, Bowes D, Sun Y (2014) Some code smells have a significant but small effect on faults. ACM Trans Softw Eng Methodol. https://doi.org/10.1145/2629648

    Article  Google Scholar 

  7. Izurieta C, Seaman C, Cai Y, Shull F, Zazworka N, Wong S, Vetro’ A (2013) Comparing four approaches for technical debt identification. Softw Qual J 22(3):403–426. https://doi.org/10.1007/s11219-013-9200-8

    Article  Google Scholar 

  8. Jaafar F, Guéhéneuc Y, Hamel S, Khomh F (2013) Mining the relationship between anti-patterns dependencies and fault-proneness. In: 2013 20th working conference on reverse engineering (WCRE), pp 351–360. https://doi.org/10.1109/WCRE.2013.6671310

  9. Jaafar F, Khomh F, Gueheneuc YG, Zulkernine M (2014) Anti-pattern mutations and fault-proneness. In: Proceedings - international conference on quality software, pp 246–255. https://doi.org/10.1109/QSIC.2014.45

  10. Jaafar F, Lozano A, Gueheneuc YG, Mens K (2017) On the analysis of co-occurrence of anti-patterns and clones. In: Proceedings - 2017 ieee international conference on software quality, reliability and security, QRS 2017. https://doi.org/10.1109/QRS.2017.38

  11. Kaur K, Kaur P (2017) Evaluation of sampling techniques in software fault prediction using metrics and code smells. In: 2017 international conference on advances in computing, communications and informatics, ICACCI 2017, vol 2017-Janua. IEEE, pp 1377–1386. https://doi.org/10.1109/ICACCI.2017.8126033

  12. Khomh F, Penta MD, Guéhéneuc YG, Antoniol G (2012) An exploratory study of the impact of antipatterns on class change- and fault-proneness. Empir Softw Eng 17(3):243–275. https://doi.org/10.1007/s10664-011-9171-y

    Article  Google Scholar 

  13. Li W, Shatnawi R (2007) An empirical study of the bad smells and class error probability in the post-release object-oriented system evolution. J Syst Softw 80(7):1120–1128. https://doi.org/10.1016/j.jss.2006.10.018

    Article  Google Scholar 

  14. Marinescu R, Marinescu C (2011) Are the clients of flawed classes (also) defect prone? In: Proceedings - 11th IEEE international working conference on source code analysis and manipulation, SCAM 2011, pp 65–74. https://doi.org/10.1109/SCAM.2011.9

  15. Olbrich SM, Cruzes DS, Sjoøberg DI (2010) Are all code smells harmful? a study of god classes and brain classes in the evolution of three open source systems. In: IEEE international conference on software maintenance. ICSM. https://doi.org/10.1109/ICSM.2010.5609564

  16. Palomba F, Bavota G, Penta MD, Fasano F, Oliveto R, Lucia AD (2018) On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation. Empir Softw Eng. https://doi.org/10.1007/s10664-017-9535-z

    Article  Google Scholar 

  17. Palomba F, Zanoni M, Fontana FA, De Lucia A, Oliveto R (2017) Smells like teen spirit: improving bug prediction performance using the intensity of code smells. In: Proceedings - 2016 IEEE international conference on software maintenance and evolution. ICSME 2016, pp. 244–255. https://doi.org/10.1109/ICSME.2016.27

  18. Palomba F, Zanoni M, Fontana FA, Lucia AD, Oliveto R (2019) Toward a smell-aware bug prediction model. IEEE Trans Softw Eng 45(2):194–218. https://doi.org/10.1109/TSE.2017.2770122

    Article  Google Scholar 

  19. Rahman F, Bird C, Devanbu P (2012) Clones: what is that smell? Empir Softw Eng 17(4–5):503–530. https://doi.org/10.1007/s10664-011-9195-3

    Article  Google Scholar 

  20. Saboury A, Musavi P, Khomh F, Antoniol G (2017) An empirical study of code smells in JavaScript projects. In: SANER 2017 - 24th IEEE international conference on software analysis, evolution, and reengineering, pp. 294–305. https://doi.org/10.1109/SANER.2017.7884630

  21. Shatnawi R, Li W (2006) An investigation of bad smells in object-oriented design. In: Proceedings - third international conference oninformation technology: new generations. ITNG 2006, vol 2006, pp 161–163. https://doi.org/10.1109/ITNG.2006.31

  22. Soltanifar B, Akbarinasaji S, Caglayan B, Bener AB, Filiz A, Kramer BM (2016) Software analytics in practice: a defect prediction model using code smells. In: Proceedings of the 20th international database engineering & applications symposium on - IDEAS ’16, pp 148–155. https://doi.org/10.1145/2938503.2938553

  23. Taba SES, Khomh F, Zou Y, Hassan AE, Nagappan M (2013) Predicting bugs using antipatterns. In: IEEE international conference on software maintenance. ICSM, pp 270–279. https://doi.org/10.1109/ICSM.2013.38

  24. Ubayawardana GM, Damith Karunaratna D (2019) Bug prediction model using code smells. In: 2018 18th international conference on advances in ICT for emerging regions (ICTer), pp 70–77. https://doi.org/10.1109/icter.2018.8615550

  25. Yamashita A, Moonen L (2013) To what extent can maintenance problems be predicted by code smell detection? -an empirical study. Inf Softw Technol. https://doi.org/10.1016/j.infsof.2013.08.002

    Article  Google Scholar 

  26. Zhang X, Zhou Y, Zhu C (2017) An empirical study of the impact of bad designs on defect proneness. In: Proceedings - 2017 annual conference on software analysis, testing and evolution, SATE 2017, vol 2017-Janua, pp 1–9. https://doi.org/10.1109/SATE.2017.9

References

  1. Arcelli Fontana F, Mäntylä MV, Zanoni M, Marino A (2016) Comparing and experimenting machine learning techniques for code smell detection. Empir Softw Eng 21(3):1143–1191

    Article  Google Scholar 

  2. Azeem MI, Palomba F, Shi L, Wang Q (2019) Machine learning techniques for code smell detection: a systematic literature review and meta-analysis. Inf Softw Technol 108(4), 115–138. https://doi.org/10.1016/j.infsof.2018.12.009

    Article  Google Scholar 

  3. Cairo AS, Carneiro GdF, Monteiro MP (2018) The impact of code smells on software bugs: a systematic literature review. Information (Switzerland) 9(11):1–22. https://doi.org/10.3390/info9110273

    Article  Google Scholar 

  4. Fowler M, Beck K, Brant J, Opdyke W, Roberts D (1999) Refactoring improving the design of existing code - fowler-beck-brant-opdyke-roberts. Xtemp01

    Google Scholar 

  5. Freitas MF, Santos JAM, do Nascimento RS, de Mendonça MG, Rocha-Junior JB, Prates LCL (2016) A systematic review on the code smell effect. J Syst Softw 144(2016):450–477. https://doi.org/10.1016/j.jss.2018.07.035

    Article  Google Scholar 

  6. Gradišnik M, Heričko M (2018) Impact of code smells on the rate of defects in software: a literature review. CEUR Work Proc 2217:27–30

    Google Scholar 

  7. Kitchenham BA, Budgen D, Brereton P (2015) Evidence-based software engineering and systematic reviews. Chapman & Hall/CRC

    Google Scholar 

  8. Le, D., Medvidovic N (2016) Architectural-based speculative analysis to predict bugs in a software system. In: Proceedings of the 38th international conference on software engineering companion, ICSE ’16. ACM, New York, NY, USA, pp 807–810. http://doi.acm.org/10.1145/2889160.2889260

  9. Ma W, Chen L, Zhou Y, Xu B (2016) Do we have a chance to fix bugs when refactoring code smells? In: Proceedings - 2016 international conference on software analysis, testing and evolution, SATE 2016, pp 24–29. https://doi.org/10.1109/SATE.2016.11

  10. Palomba F, Bavota G, Penta MD, Oliveto R, Poshyvanyk D, Lucia AD (2015) Mining version histories for detecting code smells. IEEE Trans Softw Eng 41(5):462–489

    Article  Google Scholar 

  11. Palomba F, Nucci DD, Tufano M, Bavota G, Oliveto R, Poshyvanyk D, De Lucia A (2015) Landfill: an open dataset of code smells with public evaluation. In: Proceedings of the 12th working conference on mining software repositories, MSR ’15. IEEE Press, Piscataway, NJ, USA, pp 482–485

    Google Scholar 

  12. Singh S, Kahlon KS (2011) Effectiveness of encapsulation and object-oriented metrics to refactor code and identify error prone classes using bad smells. ACM SIGSOFT Softw Eng Notes 36(5):1. https://doi.org/10.1145/2020976.2020994

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Lech Madeyski .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Piotrowski, P., Madeyski, L. (2020). Software Defect Prediction Using Bad Code Smells: A Systematic Literature Review. In: Poniszewska-Marańda, A., Kryvinska, N., Jarząbek, S., Madeyski, L. (eds) Data-Centric Business and Applications. Lecture Notes on Data Engineering and Communications Technologies, vol 40. Springer, Cham. https://doi.org/10.1007/978-3-030-34706-2_5

Download citation

Publish with us

Policies and ethics