Skip to main content

“To Clean Code or Not to Clean Code” A Survey Among Practitioners

  • Conference paper
  • First Online:
Product-Focused Software Process Improvement (PROFES 2022)

Abstract

Context: Writing code that is understandable by other collaborators has become crucial to enhancing collaboration and productivity. Clean Code has become one of the most relevant software craftsmanship practices and has been widely embraced as a synonym for code quality by software developers and software development organizations all over the world. However, very little is known regarding whether developers agree with Clean Code principles and how they apply them in practice.

Objectives: In this work, we investigated how developers perceive Clean Code principles, whether they believe that helps reading, understanding, reusing, and modifying Clean Code, and how they keep their code clean.

Methods: We conducted a Systematic Literature Review in which we screened 771 research papers to collect Clean Code principles and a survey among 39 practitioners, some of them with more than 20 years of development experience.

Results: So far, the results show a shared agreement with Clean Code principles and their potential benefits. They also show that developers tend to write “messy” code to be refactored later.

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 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.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

Similar content being viewed by others

Notes

  1. 1.

    We applied the abovementioned inclusion and exclusion criteria to define the start set and during the snowballing iterations.

  2. 2.

    The questionnaire is available for download in the companion materials in Zenodo DOI: 10.5281/zenodo.6973656.

  3. 3.

    https://www.questback.com.

  4. 4.

    As the one shown in Fig. 1.(e).

  5. 5.

    The complete results of the Wilcoxon signed-rank test are available in the companion materials in Zenodo DOI: 10.5281/zenodo.6973656.

  6. 6.

    The additional explanations for each principle is available in the companion materials in Zenodo DOI: 10.5281/zenodo.6973656.

References

  1. Ajami, S., Woodbridge, Y., Feitelson, D.G.: Syntax, predicates, idioms - what really affects code complexity? Empir. Softw. Eng. 24, 287–328 (2019). https://doi.org/10.1007/S10664-018-9628-3

    Article  Google Scholar 

  2. Almogahed, A., Omar, M., Zakaria, N.H.: Impact of software refactoring on software quality in the industrial environment: A review of empirical studies. In: Knowledge Management International Conference (KMICe), pp. 25–27, Miri Sarawak, Malaysia (2018)

    Google Scholar 

  3. Almogahed, A., Omar, M., Zakaria, N.H.: Categorization refactoring techniques based on their effect on software quality attributes. Int. J. Innov. Technol. Exploring Eng. (IJITEE) 8 (2019)

    Google Scholar 

  4. Alomar, E.A., Alrubaye, H., Mkaouer, M.W., Ouni, A., Kessentini, M.: Refactoring practices in the context of modern code review: An industrial case study at xerox. In: 43rd International Conference on Software Engineering (ICSE), pp. 348–357. IEEE, Madrid, Spain (Virtual Event) (2021)

    Google Scholar 

  5. Ammerlaan, E., Veninga, W., Zaidman, A.: Old habits die hard: Why refactoring for understandability does not give immediate benefits. In: 22nd International Conference on Software Analysis. Evolution, and Reengineering (SANER), pp. 504–507, Montreal, QC, Canada (2015)

    Google Scholar 

  6. Aniche, M.F., Oliva, G.A., Gerosa, M.A.: What do the asserts in a unit test tell us about code quality? a study on open source and industrial projects. In: 17th European Conference on Software Maintenance and Reengineering (CSMR), pp. 111–120. Genova, Italy (2013)

    Google Scholar 

  7. Arif, A., Rana, Z.A.: Refactoring of code to remove technical debt and reduce maintenance effort. In: 14th International Conference on Open Source Systems and Technologies (ICOSST), IEEE, Lahore, Pakistan (2020)

    Google Scholar 

  8. Avidan, E., Feitelson, D.G.: Effects of variable names on comprehension: An empirical study. In: 25th IEEE/ACM International Conference on Program Comprehension (ICPC), pp. 55–65. Buenos Aires, Argentina (2017)

    Google Scholar 

  9. Börstler, J., et al.: "i know it when i see it" - perceptions of code quality. In: 2017 ITiCSE Conference - Working Group Reports, pp. 70–85. ACM, Bologna, Italy (2017)

    Google Scholar 

  10. Casalnuovo, C., Devanbu, P., Oliveira, A., Filkov, V., Ray, B.: Assert use in github projects. In: 37th IEEE International Conference on Software Engineering (ICSE), pp. 755–766. IEEE, Florence, Italy (2015)

    Google Scholar 

  11. Counsell, S., Hall, T., Shippey, T., Bowes, D., Tahir, A., MacDonell, S.: Assert use and defectiveness in industrial code. In: IEEE 28th International Symposium on Software Reliability Engineering Workshops (ISSREW), pp. 20–23. IEEE, Wuhan, China (2017)

    Google Scholar 

  12. Dallal, J.A., Abdin, A.: Empirical evaluation of the impact of object-oriented code refactoring on quality attributes: A systematic literature review. IEEE Trans. Softw. Eng. 44, 44–69 (2018). https://doi.org/10.1109/TSE.2017.2658573

    Article  Google Scholar 

  13. Dibble, C., Gestwicki, P.: Refactoring code to increase readability and maintainability: A case study. J. Comput. Sci. Coll. 30(1), 41–51 (2014)

    Google Scholar 

  14. Digkas, G., Chatzigeorgiou, A.N., Ampatzoglou, A., Avgeriou, P.C.: Can clean new code reduce technical debt density. IEEE Trans. Software Eng. 48, 1–18 (2020). https://doi.org/10.1109/TSE.2020.3032557

    Article  Google Scholar 

  15. Fowler, M., Beck, K.: Refactoring Improving the Design of Existing Code. Addison Wesley, 2nd edn. (2018)

    Google Scholar 

  16. Fucci, D., Erdogmus, H., Turhan, B.: A dissection of test-driven development : Does it really matter to test-first or to test-last? IEEE Trans. Software Eng. 6, 1–20 (2015). https://doi.org/10.1109/TSE.2016.2616877

    Article  Google Scholar 

  17. Johnson, J., Lubo, S., Yedla, N., Aponte, J., Sharif, B.: An empirical study assessing source code readability in comprehension. In: IEEE International Conference on Software Maintenance and Evolution (ICSME), pp. 513–523. IEEE, Dallas, TX, USA, Sep 2019

    Google Scholar 

  18. Kim, M., Zimmermann, T., Nagappan, N.: A field study of refactoring challenges and benefits. In: ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering (FSE), p. 1. ACM Press, Cary, NC, USA (2012)

    Google Scholar 

  19. Kitchenham, B.A., Pfleeger, S.L.: Principles of survey research: Part 3 - constructing a survey instrument. In: ACM SIGSOFT Software Engineering Notes, p.20 (2002). https://doi.org/10.1145/511152.511155

  20. Koller, H.G.: Effects of Clean Code on Understandability An Experiment and Analysis. Master’s thesis, Department of Informatics, University of Oslo (2016)

    Google Scholar 

  21. Latte, B., Henning, S., Wojcieszak, M.: Clean code: On the use of practices and tools to produce maintainable code for long-living. In: Collaborative Workshop in Evolution and Maintenance of Long-Living Systems EMLS2019, Stuttgart, Germany, vol. Vol-2308, pp. 96–99 (2019), ’CEUR-WS.org’

    Google Scholar 

  22. Lee, T., Lee, J.B., Peter, H.I.: Effect analysis of coding convention violations on readability of post-delivered code. IEICE Trans. Inf. Syst. 98, 1286–1296 (2015). https://doi.org/10.1587/transinf.2014EDP7327

    Article  Google Scholar 

  23. Lerthathairat, P., Prompoon, N.: An approach for source code classification to enhance maintainability. In: 2011 Eighth International Joint Conference on Computer Science and Software Engineering (JCSSE), Nakhon Pathom, Thailand, pp. 319–324 (2011)

    Google Scholar 

  24. Lerthathairat, P., Prompoon, N.: An approach for source code classification using software metrics and fuzzy logic to improve code quality with refactoring techniques. In: Zain, J.M., Wan Mohd, W.M., El-Qawasmeh, E. (eds.) ICSECS 2011. CCIS, vol. 181, pp. 478–492. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-22203-0_42

    Chapter  Google Scholar 

  25. Linåker, J., Sulaman, S.M., Höst, M., Mello, R.M.D.: Guidelines for conducting surveys in software engineering v. 1.1. Tech. rep., Department of Computer Science, Lund University, Lund, Sweden (2015)

    Google Scholar 

  26. Lucena, P., Tizzei, L.P.: Applying software craftsmanship practices to a scrum project: an experience report. In: 1st Workshop on Social, Human and Economics Aspects of Software (WASHES), Maceió, Brazil, arxiv.org/abs/1611.05789 (2016)

  27. Martin, R.C.: Clean Code - A Handbook of Agile Software Craftmanship. Prentice Hall (2009)

    Google Scholar 

  28. Mourão, E., Kalinowski, M., Murta, L., Mendes, E., Wohlin, C.: Investigating the use of a hybrid search strategy for systematic reviews. In: Empirical Software Eninneering and Measurements (ESEM), Toronto, ON, Canada (2017)

    Google Scholar 

  29. Pantiuchina, J., et al.: Why developers refactor source code. ACM Tran. Softw. Eng. Methodology (TOSEM) 29 (2020). https://doi.org/10.1145/3408302

  30. Rachow, P., Schroder, S., Riebisch, M.: Missing clean code acceptance and support in practice - an empirical study. In: Proceedings - 25th Australasian Software Engineering Conference, pp. 131–140. IEEE, Adelaide, Australia (2018)

    Google Scholar 

  31. Sae-Lim, N., Hayashi, S., Saeki, M.: Toward proactive refactoring: An exploratory study on decaying modules. In: Proceedings - 2019 IEEE/ACM 3rd International Workshop on Refactoring (IWOR), pp. 39–46. IEEE, Montreal, QC, Canada (2019)

    Google Scholar 

  32. Sedano, T.: Code readability testing, an empirical study. In: 29th Conference on Software Engineering Education and Training (CSEE &T), pp. 111–117. IEEE, Austin, TX, USA (2016)

    Google Scholar 

  33. Sharma, T., Suryanarayana, G., Samarthyam, G.: Challenges to and solutions for refactoring adoption: An industrial perspective. IEEE Softw. 32, 44–51 (2015). https://doi.org/10.1109/MS.2015.105

    Article  Google Scholar 

  34. Steidl, D., Deissenboeck, F., Poehlmann, M., Heinke, R., Uhink-Mergenthaler, B.: Continuous software quality control in practice. In: IEEE International Conference on Software Maintenance and Evolution (ICSME), Victoria, BC, Canada, pp. 561–564 (2014)

    Google Scholar 

  35. Stevenson, J., Wood, M.: Recognising object-oriented software design quality: a practitioner-based questionnaire survey. Softw. Quality J. 26, 321–365 (2018). https://doi.org/10.1007/s11219-017-9364-8

    Article  Google Scholar 

  36. Vakilian, M., Chen, N., Negara, S., Rajkumar, B.A., Bailey, B.P., Johnson, R.E.: Use, disuse, and misuse of automated refactorings. In: International Conference on Software Engineering (ICSE), pp. 233–243. Zurich, Switzerland (2012)

    Google Scholar 

  37. Wohlin, C.: Guidelines for snowballing in systematic literature studies and a replication in software engineering. In: 18th International Conference on Evaluation and Assessment in Software Engineering (EASE), London, UK, pp. 1–10 (2014)

    Google Scholar 

  38. Yamashita, A., Moonen, L.: Do developers care about code smells? an exploratory survey. In: 20th Working Conference on Reverse Engineering (WCRE), pp. 242–251. IEEE, Koblenz, Germany (2013)

    Google Scholar 

  39. Zabardast, E., Gonzalez-Huerta, J., Smite, D.: Refactoring, bug fixing, and new development effect on technical debt : An industrial case study. In: 46th Euromicro Conference on Software Engineering and Advanced Applications (Euromicro-SEAA), pp. 376–384. IEEE, Kranj, Slovenia (Virtual Event) (2020)

    Google Scholar 

Download references

Acknowledgements

This research was supported by the KKS foundation through the SHADE KKS Hög project (Ref: 20170176) and through the KKS SERT Research Profile project (Ref. 2018010) Blekinge Institute of Technology.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Javier Gonzalez-Huerta .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Ljung, K., Gonzalez-Huerta, J. (2022). “To Clean Code or Not to Clean Code” A Survey Among Practitioners. In: Taibi, D., Kuhrmann, M., Mikkonen, T., Klünder, J., Abrahamsson, P. (eds) Product-Focused Software Process Improvement. PROFES 2022. Lecture Notes in Computer Science, vol 13709. Springer, Cham. https://doi.org/10.1007/978-3-031-21388-5_21

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-21388-5_21

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-21387-8

  • Online ISBN: 978-3-031-21388-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics