Contributing to open-source projects in refactoring code smells: A practical experience in teaching Software Maintenance - Bezerra, Carla; Alves, Victor Anthony; Lobo, Antônio Hugo; Queiroz, João Paulo; Lima, Lara; Meirelles, Paulo (Anais do Simpósio Brasileiro de Engenharia de Software (SBES); 2024: Anais do XXXVIII Simpósio Brasileiro de Engenharia de SoftwareDO - 10.5753/sbes.2024.3507, 2024)
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.