Skip to main content
zenodoopen

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

<p>Code smells are suboptimal code structures that can undermine software quality and maintainability. On the one&nbsp;hand, software engineers commonly apply refactoring techniques to address these deficiencies and improve internal quality attributes. On the other hand, when performed manually and without discipline, refactoring can lead to&nbsp;code degradation. Despite its importance, refactoring and code smells are rarely explored in depth in undergraduate&nbsp;computing courses, which can be reflected in industry practices. To address this gap, this paper presents a hands-on approach to teaching code smell refactoring through contributions to Open Source Software (OSS) projects, an&nbsp;environment where developers with diverse skill levels collaborate, and maintaining code quality is particularly&nbsp;challenging. Code smells accumulate over time in such scenarios, hindering software evolution and collaboration.&nbsp;Our study in two undergraduate Software Quality and Software Maintenance courses expands on previous findings&nbsp;by incorporating an in-depth analysis of students&rsquo; learning experiences. The results indicate that: (i) students rec-&nbsp;ognized improvements in code quality after refactoring; (ii) they identified strong connections between refactoring,&nbsp;testing, and debugging; (iii) their confidence decreased when refactoring required changes across multiple files; (iv)&nbsp;code complexity posed a significant challenge to refactoring; (v) students&rsquo; choices of refactoring techniques were&nbsp;influenced by project structure and personal preferences, often combining multiple techniques to address a single&nbsp;smell; (vi) in some cases, refactoring introduced new code smells; (vii) the longest refactoring efforts were also&nbsp;the most likely to reintroduce code smells; (viii) contributing to OSS projects improved students&rsquo; programming&nbsp;skills and fostered a sense of professional growth; (ix) students faced challenges in understanding OSS contribution&nbsp;processes, particularly regarding issue resolution, adherence to contribution guidelines, and responding to maintainer feedback; (x) automated checks and review workflows varied across projects, affecting students&rsquo; ability to&nbsp;submit successful contributions; and (xi) despite these challenges, engagement with OSS enabled students to gain&nbsp;practical experience in collaborative software development. Our findings offer valuable insights for software engineering educators seeking to integrate refactoring practices into coursework while leveraging OSS contributions as&nbsp;an educational tool.</p>

ShareScore

32/100

Overall dataset sharing score

Score breakdown

These five areas show where the dataset supports — or may limit — practical reuse.

Stewardship
4
Harmonization
4
Access
16
Reuse readiness
8
Engagement
0