Asking Students to Refactor their Code: A Simple and Valuable Exercise
Date
2024
Authors
Izu, C.
Mirolo, C.
Editors
Monga, M.
Lonati, V.
Barendsen, E.
Sheard, J.
Paterson, J.
Lonati, V.
Barendsen, E.
Sheard, J.
Paterson, J.
Advisors
Journal Title
Journal ISSN
Volume Title
Type:
Conference paper
Citation
Annual Conference on Innovation and Technology in Computer Science Education, ITiCSE, 2024 / Monga, M., Lonati, V., Barendsen, E., Sheard, J., Paterson, J. (ed./s), vol.1, pp.73-79
Statement of Responsibility
Cruz Izu, Claudio Mirolo
Conference Name
Innovation and Technology in Computer Science Education (ITiCSE) (8 Jul 2024 - 10 Jul 2024 : Milan, Italy)
Abstract
Whilst most undergraduate students eventually produce functionally correct code, they often disregard their code style and overall quality when it is not graded. As reported by the literature, quality defects affect both code structure and code style, and these issues seem to persist even in later years. This paper reports on the potential of a low-cost intervention that directed CS2 students to revise and refactor their code, with a specific focus on code structure, by resorting to a range of online refactoring resources. A “refactor-your-working-solution” assignment received 73 submissions by 47 students. For each cleaned solution, students were required to provide a one-page report documenting their improvements step-by-step, and include a short reflection on their learning. Their efforts to clean code and their reflections are analysed in this experience report. Most students were able to apply multiple refactoring steps as well as other editing steps to improve their code style. In particular, we have identified a wide range of code smells in their code, hence gaining insights on their success in locating and removing 90% of them. Additionally, students’ reflections appear to indicate an increased awareness as to the importance of readability and the need to develop more consistent habits when planning, coding and documenting their software.
School/Discipline
Dissertation Note
Provenance
Description
Access Status
Rights
© 2024 Copyright held by the owner/author(s). Publication rights licensed to ACM