Position: Manual Refactoring (by Novice Programmers) Considered Harmful

In recent years, the issue of quality in introductory and end-user programming has become increasingly prominent. In particular, the poor quality of block-based programs has been shown to harm the educational effectiveness in this programming domain. As a result, there has been a growing interest in code quality and its improvement practices among researchers and educators. Refactoring—transforming code to remove quality problems while preserving semantics—is taught as a common and practical technique for improving code quality. To maximize pedagogical effectiveness, some educators advocate teaching students to refactor by hand to elucidate the mechanics behind refactoring instead of relying on tools that transform code automatically. In this position paper, we argue that this pedagogical approach is counterproductive. We advocate teaching refactoring similarly to compilation, a technique that students start applying automatically right away, but learn its inner workings only much later in the curriculum. Even professional developers are advised to avoid carrying out complex refactoring transformations by hand, as this activity leads to hard-to-trace bugs as well as wastes time and effort. To put appropriate tools for improving software quality into the hands of Scratch programmers, we created an automated refactoring infrastructure for Scratch, and we argue that such facility should become a mainstay of programming environments for blocks.

[1]  Andrew P. Black,et al.  How We Refactor, and How We Know It , 2012, IEEE Trans. Software Eng..

[2]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).