Refactoria: A Game-Based Tool for Learning Code Refactoring
Refactoring is a crucial practice in software maintenance, that aims at improving coding practices while addressing design flaws. Due to the importance of the topic, several methods and strategies have been proposed for teaching and training refactoring, including interactive learning, incremental learning, gamification, visualization, experimentation, and e-activity planning. However, the skills needed to identify and refactor code smells come from training and experience, and the lack of motivation may hinder developers in the adoption of refactoring tools. In this paper, we aim at developing Refactoria, an innovative game-based learning environment that supports the acquisition of code smell and refactoring concepts through interactive gameplay. The players play as an expert chef with their sidekick Watson the Whiskbot to refactor Watson’s instructions into efficient, readable, and easily maintainable code. We present an experiment with 24 student developers. In particular, we study the perception, effectiveness, and usefulness of gamification to engage developers in code smell identification and refactoring. Our results show that the game is effective in teaching developers code smell and refactoring concepts. In light of our findings, we believe that Refactoria contributes a unique blend of pedagogical innovation and practical relevance.