Refactoring Code Smells in Open Source Projects: A Hands-on Approach to Teaching Software Maintenance

Authors

DOI:

https://doi.org/10.5753/jserd.2026.5688

Keywords:

Code Smells, Refactoring, Software Engineering Education, Open-source Software

Abstract

Code smells are suboptimal structures that undermine software quality. While refactoring is the standard technique to address them, its manual application can degrade code if done without discipline. Despite its importance, refactoring is rarely explored in depth in undergraduate computing courses, creating a gap between academia and industry.
Simultaneously, Open Source Software (OSS) projects offer authentic, hands-on learning environments for software maintenance. To address the academic gap and leverage this opportunity, this paper presents and evaluates a hands-on pedagogical approach for teaching code smell refactoring through student contributions to OSS projects. We implemented this approach in two undergraduate Software Quality and Maintenance courses. Our analysis of students' learning experiences reveals that they recognized quality improvements and the connection between refactoring and testing. However, they faced challenges with code complexity and cross-file changes, which sometimes inadvertently introduced new code smells. Regarding the OSS experience, students reported professional growth but struggled with contribution workflows and receiving feedback from maintainers. Our findings offer valuable insights and propose actionable pedagogical recommendations for educators seeking to integrate advanced software maintenance practices into their curricula by leveraging the real-world environment of OSS.

Downloads

Download data is not yet available.

References

Aberdour, M. (2007). Achieving quality in open source software. IEEE Software, 24(01):58–64.

Agrahari, V. and Chimalakonda, S. (2020). Refactor4green: a game for novice programmers to learn code smells. In 2020 IEEE/ACM 42nd International Conference on Software Engineering: Companion Proceedings (ICSE-Companion), pages 324–325. IEEE.

Al Dallal, J. and Abdin, A. (2018). Empirical evaluation of the impact of object-oriented code refactoring on quality attributes: A systematic literature review. IEEE Transactions on Software Engineering, 44(1):44–69.

AlOmar, E. A., Mkaouer, M. W., and Ouni, A. (2024). Automating source code refactoring in the classroom. In Proceedings of the 55th ACM Technical Symposium on Computer Science Education V. 1, SIGCSE 2024, page 60–66, New York, NY, USA. Association for Computing Machinery.

Berg, A., Osnes, S., and Glassey, R. (2022). If in doubt, try three: Developing better version control commit behaviour with first year students. In Proceedings of the 53rd ACM Technical Symposium on Computer Science Education - Volume 1, SIGCSE 2022, page 362–368, New York, NY, USA. Association for Computing Machinery.

Bezerra, C., Alves, V., Lobo, A., Queiroz, J., Lima, L., and Meirelles, P. (2024). Contributing to open-source projects in refactoring code smells: A practical experience in teaching software maintenance. In Anais do XXXVIII Simpósio Brasileiro de Engenharia de Software, pages 399–409, Porto Alegre, RS, Brasil. SBC.

Bezerra, C., Damasceno, H., and Teixeira, J. (2022). Perceptions and difficulties of software engineering students in code smells refactoring. In Anais do X Workshop de Visualização, Evolução e Manutenção de Software, pages 41–45, Porto Alegre, RS, Brasil. SBC.

Braun, V. and Clarke, V. (2006). Using thematic analysis in psychology. Qualitative Research in Psychology, 3(2):77–101.

Chidamber, S. R. and Kemerer, C. F. (1994). A metrics suite for object oriented design. IEEE Transactions on Software Engineering, 20(6):476–493.

Destefanis, G., Counsell, S., Concas, G., and Tonelli, R. (2014). Software metrics in agile software: An empirical study. In International Conference on Agile Software Development, pages 157–170. Springer.

Diniz, G. C., Silva, M. A. G., Gerosa, M. A., and Steinmacher, I. (2017). Using gamification to orient and motivate students to contribute to oss projects. In 2017 IEEE/ACM 10th International Workshop on Cooperative and Human Aspects of Software Engineering (CHASE), pages 36–42.

Dong, J. Q. and Götz, S. J. (2021). Project leaders as boundary spanners in open source software development: A resource dependence perspective. Information Systems Journal, 31(5):672–694.

dos Santos, H. M., Durelli, V. H. S., Souza, M., Figueiredo, E., da Silva, L. T., and Durelli, R. S. (2019). Cleangame: Gamifying the identification of code smells. In Proceedings of the XXXIII Brazilian Symposium on Software Engineering, SBES 2019, page 437–446, New York, NY, USA. Association for Computing Machinery.

Ellis, H. J. C., Hislop, G. W., Chua, M., Kussmaul, C., and Burke, M. M. (2010). Panel — teaching students to participate in open source software projects. In 2010 IEEE Frontiers in Education Conference (FIE), pages F2B–1–F2B–2.

Farchi, E., Nir, Y., and Ur, S. (2003). Concurrent bug patterns and how to test them. In Proceedings International Parallel and Distributed Processing Symposium, pages 7 pp.–.

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

Fernandes, E., Oliveira, J., Vale, G., Paiva, T., and Figueiredo, E. (2016). A review-based comparative study of bad smell detection tools. In Proceedings of the 20th International Conference on Evaluation and Assessment in Software Engineering, EASE ’16, New York, NY, USA. Association for Computing Machinery.

Ferreira, F. and Valente, M. T. (2023). Detecting code smells in react-based web apps. Information and Software Technology, 155:107111.

Fowler, M. (2018). Refactoring: improving the Design of Existing Code. Addison-Wesley Professional.

França, C., da Silva, F. Q. B., and Sharp, H. (2020). Motivation and satisfaction of software engineers. IEEE Transactions on Software Engineering, 46(2):118–140.

Golubev, Y., Kurbatova, Z., AlOmar, E. A., Bryksin, T., and Mkaouer, M. W. (2021). One thousand and one stories: A large-scale survey of software refactoring. In Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, ESEC/FSE 2021, page 1303–1313, New York, NY, USA. Association for Computing Machinery.

Haider, S., Khalil, W., Al-Shamayleh, A. S., Akhunzada, A., and Gani, A. (2023). Risk factors and practices for the development of open source software from developers’ perspective. IEEE Access, 11:63333–63350.

Halepmollasi, R. and Tosun, A. (2024). Exploring the relationship between refactoring and code debt indicators. Journal of Software: Evolution and Process, 36(1):e2447.

Hoffmann, M., Nagle, F., and Zhou, Y. (2024). The value of open source software. Harvard Business School Strategy Unit Working Paper, (24-038).

Hu, Z., Song, Y., and Gehringer, E. F. (2019). A test-driven approach to improving student contributions to open-source projects. In 2019 IEEE Frontiers in Education Conference (FIE), pages 1–9.

Inc., S. T. (2023). Understand software metrics.

Jiang, J.-Y., Cheng, P.-J., and Wang, W. (2017). Open source repository recommendation in social coding. In Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR ’17, page 1173–1176, New York, NY, USA. Association for Computing Machinery.

Jin, Y., Bai, Y., Zhu, Y., Sun, Y., and Wang, W. (2023). Code recommendation for open source software developers. In Proceedings of the ACM Web Conference 2023, WWW ’23, page 1324–1333, New York, NY, USA. Association for Computing Machinery.

Kaur, A., Jain, S., Goel, S., and Dhiman, G. (2021). A review on machine-learning based code smell detection techniques in object-oriented software system(s). Recent Advances in Electrical Electronic Engineering, 14(3):290–303.

Keuning, H., Heeren, B., and Jeuring, J. (2019). How teachers would help students to improve their code. In Proceedings of the 2019 ACM Conference on Innovation and Technology in Computer Science Education, ITiCSE ’19, page 119–125, New York, NY, USA. Association for Computing Machinery.

Keuning, H., Heeren, B., and Jeuring, J. (2021). A tutoring system to learn code refactoring. In Proceedings of the 52nd ACM Technical Symposium on Computer Science Education, SIGCSE ’21, page 562–568, New York, NY, USA. Association for Computing Machinery.

Khomh, F., Di Penta, M., and Gueheneuc, Y.-G. (2009). An exploratory study of the impact of code smells on software change-proneness. In 2009 16th Working Conference on Reverse Engineering, pages 75–84.

Lacerda, G., Petrillo, F., Pimenta, M., and Guéhéneuc, Y. G. (2020). Code smells and refactoring: A tertiary systematic review of challenges and observations. Journal of Systems and Software, 167:110610.

Lorenz, M. and Kidd, J. (1994). Object-oriented software metrics: a practical guide. Prentice-Hall, Inc.

Mariani, T. and Vergilio, S. R. (2017). A systematic review on search-based refactoring. Information and Software Technology, 83:14–34.

Martins, J., Bezerra, C., Uchôa, A., and Garcia, A. (2020). Are code smell co-occurrences harmful to internal quality attributes? A mixed-method study. In Proceedings of the 34th Brazilian Symposium on Software Engineering, SBES ’20, page 52–61, New York, NY, USA. Association for Computing Machinery.

Martins, J., Bezerra, C., Uchôa, A., and Garcia, A. (2021). How Do Code Smell Co-Occurrences Removal Impact Internal Quality Attributes? A Developers’ Perspective, page 54–63. Association for Computing Machinery, New York, NY, USA.

McCabe, T. J. (1976). A complexity measure. IEEE Transactions on Software Engineering, (4):308–320.

Menolli, A., Strik, B., and Rodrigues, L. (2024). Teaching refactoring to improve code quality with chatgpt: An experience report in undergraduate lessons. In Proceedings of the XXIII Brazilian Symposium on Software Quality, SBQS ’24, page 563–574, New York, NY, USA. Association for Computing Machinery.

Morgan, B. and Jensen, C. (2014). Lessons learned from teaching open source software development. In Corral, L., Sillitti, A., Succi, G., Vlasenko, J., and Wasserman, A. I., editors, Open Source Software: Mobile Open Source Technologies, pages 133–142, Berlin, Heidelberg. Springer Berlin Heidelberg.

Nanthaamornphong, A. and Boonchieng, E. (2023). An exploratory study on code smells during code review in oss projects: A case study on openstack and wikimedia. Recent Advances in Computer Science and Communications, 16(7):20–33.

Nanthaamornphong, A., Saeang, T., and Tularak, P. (2020). Zsmell – code smell detection for open source software. International Journal on Advanced Science, Engineering and Information Technology, 10(3):1035–1041.

Nascimento, D. M., Cox, K., Almeida, T., Sampaio, W., Bittencourt, R. A., Souza, R., and Chavez, C. (2013). Using open source projects in software engineering education: A systematic mapping study. In 2013 IEEE Frontiers in Education Conference (FIE), pages 1837–1843.

Oizumi, W., Garcia, A., da Silva Sousa, L., Cafeo, B., and Zhao, Y. (2016). Code anomalies flock together: Exploring code anomaly agglomerations for locating design problems. In Proceedings of the 38th International Conference on Software Engineering, ICSE ’16, page 440–451, New York, NY, USA. Association for Computing Machinery.

Pinto, G., Ferreira, C., Souza, C., Steinmacher, I., and Meirelles, P. (2019). Training software engineers using open-source software: The students’ perspective. In 2019 IEEE/ACM 41st International Conference on Software Engineering: Software Engineering Education and Training (ICSE-SEET), pages 147–157.

Qiu, H. S., Lieb, A., Chou, J., Carneal, M., Mok, J., Amspoker, E., Vasilescu, B., and Dabbish, L. (2023). Climate coach: A dashboard for open-source maintainers to overview community dynamics. In Proceedings of the 2023 CHI Conference on Human Factors in Computing Systems, CHI ’23, New York, NY, USA. Association for Computing Machinery.

Silva, J. O., Wiese, I., German, D. M., Treude, C., Gerosa, M. A., and Steinmacher, I. (2020). Google summer of code: Student motivations and contributions. Journal of Systems and Software, 162:110487.

Sousa, L., Oliveira, A., Oizumi, W., Barbosa, S., Garcia, A., Lee, J., Kalinowski, M., de Mello, R., Fonseca, B., Oliveira, R., Lucena, C., and Paes, R. (2018). Identifying design problems in the source code: A grounded theory. In Proceedings of the 40th International Conference on Software Engineering, ICSE ’18, page 921–931, New York, NY, USA. Association for Computing Machinery.

Tahir, A., Yamashita, A., Licorish, S., Dietrich, J., and Counsell, S. (2018). Can you tell me if it smells? A study on how developers discuss code smells and anti-patterns in stack overflow. In Proceedings of the 22nd International Conference on Evaluation and Assessment in Software Engineering 2018, EASE ’18, page 68–78, New York, NY, USA. Association for Computing Machinery.

Wohlin, C., Runeson, P., Höst, M., Ohlsson, M. C., Regnell, B., and Wesslén, A. (2012). Experimentation in software engineering. Springer Science & Business Media.

Yamashita, A. and Moonen, L. (2013). Do developers care about code smells? An exploratory survey. In 2013 20th Working Conference on Reverse Engineering (WCRE), pages 242–251.

Yu, Y., Wang, H., Yin, G., and Wang, T. (2016). Reviewer recommendation for pull-requests in github: What can we learn from code review and bug assignment? Information and Software Technology, 74:204–218.

Downloads

Published

2026-05-02

How to Cite

Bezerra, C., Alves, V. A., Lobo, A. H., Queiroz, J. P., Lima, L., & Meirelles, P. (2026). Refactoring Code Smells in Open Source Projects: A Hands-on Approach to Teaching Software Maintenance. Journal of Software Engineering Research and Development, 14(1), 44–61. https://doi.org/10.5753/jserd.2026.5688

Issue

Section

Research Article