Fixing Your Own Smells: Adding a Mistake-Based Familiarisation Step When Teaching Code Refactoring (2401.01011v1)
Abstract: Programming problems can be solved in a multitude of functionally correct ways, but the quality of these solutions (e.g. readability, maintainability) can vary immensely. When code quality is poor, symptoms emerge in the form of 'code smells', which are specific negative characteristics (e.g. duplicate code) that can be resolved by applying refactoring patterns. Many undergraduate computing curricula train students on this software engineering practice, often doing so via exercises on unfamiliar instructor-provided code. Our observation, however, is that this makes it harder for novices to internalise refactoring as part of their own development practices. In this paper, we propose a new approach to teaching refactoring, in which students must first complete a programming exercise constrained to ensure they will produce a code smell. This simple intervention is based on the idea that learning refactoring is easier if students are familiar with the code (having built it), that it brings refactoring closer to their regular development practice, and that it presents a powerful opportunity to learn from a 'mistake'. We designed and conducted a study with 35 novice undergraduates in which they completed various refactoring exercises alternately taught using a traditional and our 'mistake-based' approach, finding that students were significantly more effective and confident at completing exercises using the latter.
- 2023. Refactoring: clean your code. https://refactoring.guru/refactoring. Accessed: December 2023.
- 2023. Supplementary Materials: Exercises and Videos. https://sites.google.com/view/fixingyourownsmells/home.
- Reflections on Teaching Refactoring: A Tale of Two Projects. In ITiCSE. ACM, 225–230.
- Perceptions and Difficulties of Software Engineering Students in Code Smells Refactoring. In VEM. SBC, 41–45.
- Hyperstyle: A Tool for Assessing the Code Quality of Solutions to Programming Assignments. In SIGCSE (1). ACM, 307–313.
- Raffaella Borasi. 1994. Capitalizing on Errors as “Springboards for Inquiry”: A Teaching Experiment. J. Res. Math. Educ. 25, 2 (1994), 166 – 208.
- ”I know it when I see it”: Perceptions of Code Quality. In ITiCSE. ACM, 389.
- Tomás Effenberger and Radek Pelánek. 2022. Code Quality Defects across Introductory Programming Topics. In SIGCSE (1). ACM, 941–947.
- A review-based comparative study of bad smell detection tools. In EASE. ACM, 18:1–18:12.
- Martin Fowler. 2018. Refactoring - Improving the Design of Existing Code (2nd ed.). Addison-Wesley.
- David Ginat. 2008. Learning from wrong and creative algorithm design. In SIGCSE. ACM, 26–30.
- Jean M. Griffin. 2019. Designing Intentional Bugs for Learning. In UKICER. ACM, 5:1–5:7.
- Sorting the Slow Way: An Analysis of Perversely Awful Randomized Sorting Algorithms. In FUN (Lecture Notes in Computer Science, Vol. 4475). Springer, 183–197.
- How video production affects student engagement: an empirical study of MOOC videos. In L@S. ACM, 41–50.
- Thorsten Haendler and Gustaf Neumann. 2019. Serious Refactoring Games. In HICSS. ScholarSpace, 1–10.
- RefacTutor: An Interactive Tutoring System for Software Refactoring. In CSEDU (Selected Papers) (Communications in Computer and Information Science, Vol. 1220). Springer, 236–261.
- A Resource to Support Novices Refactoring Conditional Statements. In ITiCSE (1). ACM, 344–350.
- Student Refactoring Behaviour in a Programming Tutor. In Koli Calling. ACM, 4:1–4:10.
- A Tutoring System to Learn Code Refactoring. In SIGCSE. ACM, 562–568.
- Bertrand Meyer. 1997. Object-Oriented Software Construction (2nd ed.). Prentice-Hall.
- Student Code Refactoring Misconceptions. In ITiCSE (1). ACM, 19–25.
- Eng Lieh Ouh and Yunghans Irawan. 2018. Exploring Experiential Learning Model and Risk Management Process for an Undergraduate Software Architecture Course. In FIE. IEEE, 1–9.
- Seymour Papert. 1980. Mindstorms: Children, computers and powerful ideas. Harvester.
- Clean Code and Design Educational Tool. In MIPRO. IEEE, 1601–1606.
- XSS for the Masses: Integrating Security in a Web Programming Course using a Security Scanner. In ITiCSE (1). ACM, 463–469.
- Ian Sommerville. 2015. Software Engineering (10th ed.). Pearson.
- Hamed Taherdoost. 2019. What is the best response scale for survey and questionnaire design; review of different lengths of rating scale/attitude scale/Likert scale. International Journal of Academic Research in Management (2019), 1–10.
- When and Why Your Code Starts to Smell Bad. In ICSE (1). IEEE Computer Society, 403–414.