Contributing to open-source projects in refactoring code smells: A practical experience in teaching Software Maintenance

  • Carla Bezerra UFC
  • Victor Anthony Alves UFC
  • Antônio Hugo Lobo UFC
  • João Paulo Queiroz UFC
  • Lara Lima UFC
  • Paulo Meirelles USP

Resumo


Code smells are inadequate code structures that can harm quality and maintainability. To remove these deficient structures, developers use refactoring techniques. Refactoring helps code be easier to understand and modify by eliminating potential problems and improving internal quality attributes. Most refactoring activities are usually performed manually and undisciplined, which can cause code degradation. Concepts, practices, software refactoring tools, and code smells are rarely discussed in undergraduate computing courses. This problem is reflected in the software industry, which generally does not use refactoring practices to improve code readability and maintainability. In this context, we present in this paper an experience report on teaching the practice of code smell refactoring and the impact on internal quality attributes through contribution to Open Source Software (OSS) projects. The study was carried out in two undergraduate classes in Software Quality and Software Maintenance courses, and our main results were that: (i) students observed improvements in code quality after refactoring smells; (ii) they noted connections between refactoring, testing, and debugging; (iii) they felt less confident refactoring code spread across multiple files; (iv) code complexity hindered their ability to refactor; (v) the choice of refactoring techniques depended on factors like project structure and personal preference, with techniques often used in combination to address a single smell; (vi) most refactorings decrease internal quality attributes; (vii) contributing to OSS projects fostered a sense of programmer growth; and, (viii) project clarity was linked to its potential for collaboration.

Palavras-chave: code smells, refactoring, software engineering education, open-source software

Referências

M. Aberdour. 2007. Achieving Quality in Open Source Software. IEEE Software 24, 01 (jan 2007), 58–64. DOI: 10.1109/MS.2007.2

Vartika Agrahari and Sridhar Chimalakonda. 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). IEEE, 324–325. DOI: 10.1145/3377812.3390792

Jehad Al Dallal and Anas Abdin. 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 (2018), 44–69. DOI: 10.1109/TSE.2017.2658573

Eman Abdullah AlOmar, Mohamed Wiem Mkaouer, and Ali Ouni. 2024. Automating Source Code Refactoring in the Classroom. In Proceedings of the 55th ACM Technical Symposium on Computer Science Education V. 1 (<conf-loc>, <city>Portland</city>, <state>OR</state>, <country>USA</country>, </confloc>) (SIGCSE 2024). Association for Computing Machinery, New York, NY, USA, 60–66. DOI: 10.1145/3626252.3630787

J Anderson. 2020. Addressing novice coding patterns: Evaluating and improving a tool for code analysis and feedback. Report UUCS-20-002, University of Utah, Tech. Rep. (2020).

Amanda Berg, Simon Osnes, and Richard Glassey. 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 (Providence, RI, USA) (SIGCSE 2022). Association for Computing Machinery, New York, NY, USA, 362–368. DOI: 10.1145/3478431.3499371

Carla Bezerra, Humberto Damasceno, and João Teixeira. 2022. Perceptions and Difficulties of Software Engineering Students in Code Smells Refactoring. In Anais do XWorkshop de Visualização, Evolução e Manutenção de Software (Online). SBC, Porto Alegre, RS, Brasil, 41–45. DOI: 10.5753/vem.2022.226804

A. Capiluppi, P. Lago, and M. Morisio. 2003. Characteristics of open source projects. In Seventh European Conference onSoftware Maintenance and Reengineering, 2003. Proceedings. 317–327. DOI: 10.1109/CSMR.2003.1192440

Shyam R Chidamber and Chris F Kemerer. 1994. A metrics suite for object oriented design. IEEE Transactions on Software Engineering 20, 6 (1994), 476–493. DOI: 10.1109/32.295895

Giuseppe Destefanis, Steve Counsell, Giulio Concas, and Roberto Tonelli. 2014. Software metrics in agile software: An empirical study. In International Conference on Agile Software Development. Springer, 157–170. DOI: 10.1007/978-3-319-06862-6_11

Guilherme C. Diniz, Marco A. Graciotto Silva, Marco A. Gerosa, and Igor Steinmacher. 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). 36–42. DOI: 10.1109/CHASE.2017.7

Hoyama Maria dos Santos, Vinicius H. S. Durelli, Maurício Souza, Eduardo Figueiredo, Lucas Timoteo da Silva, and Rafael S. Durelli. 2019. CleanGame: Gamifying the Identification of Code Smells. In Proceedings of the XXXIII Brazilian Symposium on Software Engineering (Salvador, Brazil) (SBES 2019). Association for Computing Machinery, New York, NY, USA, 437–446. DOI: 10.1145/3350768.3352490

Heidi J. C. Ellis, Gregory W. Hislop, Mel Chua, Clif Kussmaul, and Matthew M. Burke. 2010. Panel — Teaching students to participate in Open Source Software projects. In 2010 IEEE Frontiers in Education Conference (FIE). F2B–1–F2B–2. DOI: 10.1109/FIE.2010.5673437

E. Farchi, Y. Nir, and S. Ur. 2003. Concurrent bug patterns and how to test them. In Proceedings International Parallel and Distributed Processing Symposium. 7 pp.–. DOI: 10.1109/IPDPS.2003.1213511

Eduardo Fernandes, Alexander Chávez, Alessandro Garcia, Isabella Ferreira, Diego Cedrim, Leonardo Sousa, and Willian Oizumi. 2020. Refactoring effect on internal quality attributes: What haven’t they told you yet? Information and Contributing to open-source projects in refactoring code smells: Software Technology 126 (2020), 106347. DOI: 10.1016/j.infsof.2020.106347

Eduardo Fernandes, Johnatan Oliveira, Gustavo Vale, Thanis Paiva, and Eduardo Figueiredo. 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 (Limerick, Ireland) (EASE ’16). Association for Computing Machinery, New York, NY, USA, Article 18, 12 pages. DOI: 10.1145/2915970.2915984

Fabio Ferreira and Marco Tulio Valente. 2023. Detecting code smells in Reactbased Web apps. Information and Software Technology 155 (2023), 107111.

Martin Fowler. 2018. Refactoring: improving the Design of Existing Code. Addison-Wesley Professional.

Yaroslav Golubev, Zarina Kurbatova, Eman Abdullah AlOmar, Timofey Bryksin, and Mohamed Wiem Mkaouer. 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 (Athens, Greece) (ESEC/FSE 2021). Association for Computing Machinery, New York, NY, USA, 1303–1313. DOI: 10.1145/3468264.3473924

Shehzad Haider,Wajeeha Khalil, Ahmad Sami Al-Shamayleh, Adnan Akhunzada, and Abdullah Gani. 2023. Risk Factors and Practices for the Development of Open Source Software From Developers’ Perspective. IEEE Access 11 (2023), 63333–63350. DOI: 10.1109/ACCESS.2023.3267048

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

Zhewei Hu, Yang Song, and Edward F. Gehringer. 2019. A Test-Driven Approach to Improving Student Contributions to Open-Source Projects. In 2019 IEEE Frontiers in Education Conference (FIE). 1–9. DOI: 10.1109/FIE43999.2019.9028521

Scientific Toolworks Inc. 2023. Understand Software Metrics. [link]

Jyun-Yu Jiang, Pu-Jen Cheng, and Wei Wang. 2017. Open Source Repository Recommendation in Social Coding. In Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval (Shinjuku, Tokyo, Japan) (SIGIR ’17). Association for Computing Machinery, New York, NY, USA, 1173–1176. DOI: 10.1145/3077136.3080753

Yiqiao Jin, Yunsheng Bai, Yanqiao Zhu, Yizhou Sun, and Wei Wang. 2023. Code Recommendation for Open Source Software Developers. In Proceedings of the ACM Web Conference 2023 (<conf-loc>, <city>Austin</city>, <state>TX</state>, <country>USA</country>, </conf-loc>) (WWW ’23). Association for Computing Machinery, New York, NY, USA, 1324–1333. DOI: 10.1145/3543507.3583503

Hieke Keuning, Bastiaan Heeren, and Johan Jeuring. 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 (Aberdeen, Scotland Uk) (ITiCSE ’19). Association for Computing Machinery, New York, NY, USA, 119–125. DOI: 10.1145/3304221.3319780

Hieke Keuning, Bastiaan Heeren, and Johan Jeuring. 2021. A Tutoring System to Learn Code Refactoring. In Proceedings of the 52nd ACM Technical Symposium on Computer Science Education (Virtual Event, USA) (SIGCSE ’21). Association for Computing Machinery, New York, NY, USA, 562–568. DOI: 10.1145/3408877.3432526

Foutse Khomh, Massimiliano Di Penta, and Yann-Gael Gueheneuc. 2009. An Exploratory Study of the Impact of Code Smells on Software Change-proneness. In 2009 16th Working Conference on Reverse Engineering. 75–84. DOI: 10.1109/WCRE.2009.28

Guilherme Lacerda, Fabio Petrillo, Marcelo Pimenta, and Yann Gaël Guéhéneuc. 2020. Code smells and refactoring: A tertiary systematic review of challenges and observations. Journal of Systems and Software 167 (2020), 110610. DOI: 10.1016/j.jss.2020.110610

Mark Lorenz and Jeff Kidd. 1994. Object-oriented software metrics: a practical guide. Prentice-Hall, Inc.

Thainá Mariani and Silvia Regina Vergilio. 2017. A systematic review on searchbased refactoring. Information and Software Technology 83 (2017), 14–34. DOI: 10.1016/j.infsof.2016.11.009

Júlio Martins, Carla Bezerra, Anderson Uchôa, and Alessandro Garcia. 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 (Natal, Brazil) (SBES ’20). Association for Computing Machinery, New York, NY, USA, 52–61. DOI: 10.1145/3422392.3422419

Júlio Martins, Carla Bezerra, Anderson Uchôa, and Alessandro Garcia. 2021. How Do Code Smell Co-Occurrences Removal Impact Internal Quality Attributes? A Developers’ Perspective. Association for Computing Machinery, New York, NY, USA, 54–63. DOI: 10.1145/3474624.3474642

Thomas J McCabe. 1976. A complexity measure. IEEE Transactions on Software Engineering 4 (1976), 308–320. [link]

Nora McDonald and Sean Goggins. 2013. Performance and participation in open source software on GitHub. In CHI ’13 Extended Abstracts on Human Factors in Computing Systems (Paris, France) (CHI EA ’13). Association for Computing Machinery, New York, NY, USA, 139–144. DOI: 10.1145/2468356.2468382

Aziz Nanthaamornphong and Ekkarat Boonchieng. 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 (Formerly: Recent Patents on Computer Science) 16, 7 (2023), 20–33. DOI: 10.2174/2666255816666230222112313

Debora Maria Nascimento, Kenia Cox, Thiago Almeida, Wendell Sampaio, Roberto Almeida Bittencourt, Rodrigo Souza, and Christina Chavez. 2013. Using Open Source Projects in software engineering education: A systematic mapping study. In 2013 IEEE Frontiers in Education Conference (FIE). 1837–1843. DOI: 10.1109/FIE.2013.6685155

Willian Oizumi, Alessandro Garcia, Leonardo da Silva Sousa, Bruno Cafeo, and Yixue Zhao. 2016. Code Anomalies Flock Together: Exploring Code Anomaly Agglomerations for Locating Design Problems. In Proceedings of the 38th International Conference on Software Engineering (Austin, Texas) (ICSE ’16). Association for Computing Machinery, New York, NY, USA, 440–451. DOI: 10.1145/2884781.2884868

Gustavo Pinto, Clarice Ferreira, Cleice Souza, Igor Steinmacher, and Paulo Meirelles. 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). 147–157. DOI: 10.1109/ICSE-SEET.2019.00024

Huilian Sophie Qiu, Anna Lieb, Jennifer Chou, Megan Carneal, Jasmine Mok, Emily Amspoker, Bogdan Vasilescu, and Laura Dabbish. 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 (<conf-loc>, <city>Hamburg</city>, <country>Germany</country>, </conf-loc>) (CHI ’23). Association for Computing Machinery, New York, NY, USA, Article 552, 18 pages. DOI: 10.1145/3544548.3581317

Fernanda Gomes Silva, Paulo Ezequiel D. Santos, and Christina von Flach. 2023. OSS in Software Engineering Education: Mapping Characteristics of Brazilian Instructors. Journal of Software Engineering Research and Development 11, 1 (Jan. 2023), 2:1 – 2:14. DOI: 10.5753/jserd.2023.1977

Jefferson O. Silva, Igor Wiese, Daniel M. German, Christoph Treude, Marco A. Gerosa, and Igor Steinmacher. 2020. Google summer of code: Student motivations and contributions. Journal of Systems and Software 162 (2020), 110487. DOI: 10.1016/j.jss.2019.110487

Leonardo Sousa, Anderson Oliveira, Willian Oizumi, Simone Barbosa, Alessandro Garcia, Jaejoon Lee, Marcos Kalinowski, Rafael de Mello, Baldoino Fonseca, Roberto Oliveira, Carlos Lucena, and Rodrigo Paes. 2018. Identifying Design Problems in the Source Code: A Grounded Theory. In Proceedings of the 40th International Conference on Software Engineering (Gothenburg, Sweden) (ICSE ’18). Association for Computing Machinery, New York, NY, USA, 921–931. DOI: 10.1145/3180155.3180239

Diomidis Spinellis. 2021. Why computing students should contribute to open source software projects. Commun. ACM 64, 7 (jun 2021), 36–38. DOI: 10.1145/3437254

Amjed Tahir, Aiko Yamashita, Sherlock Licorish, Jens Dietrich, and Steve Counsell. 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 (Christchurch, New Zealand) (EASE’18). Association for Computing Machinery, New York, NY, USA, 68–78. DOI: 10.1145/3210459.3210466

Claes Wohlin, Per Runeson, Martin Höst, Magnus C. Ohlsson, Björn Regnell, and Anders Wesslén. 2012. Experimentation in software engineering. Springer Science & Business Media.

Aiko Yamashita and Leon Moonen. 2013. Do developers care about code smells? An exploratory survey. In 2013 20th Working Conference on Reverse Engineering (WCRE). 242–251. DOI: 10.1109/WCRE.2013.6671299

Yue Yu, Huaimin Wang, Gang Yin, and Tao Wang. 2016. Reviewer recommendation for pull-requests in GitHub: What can we learn from code review and bug assignment? Information and Software Technology 74 (2016), 204–218. DOI: 10.1016/j.infsof.2016.01.004
Publicado
30/09/2024
BEZERRA, Carla; ALVES, Victor Anthony; LOBO, Antônio Hugo; QUEIROZ, João Paulo; LIMA, Lara; MEIRELLES, Paulo. Contributing to open-source projects in refactoring code smells: A practical experience in teaching Software Maintenance. In: SIMPÓSIO BRASILEIRO DE ENGENHARIA DE SOFTWARE (SBES), 38. , 2024, Curitiba/PR. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2024 . p. 399-409. DOI: https://doi.org/10.5753/sbes.2024.3507.