It Will Never Work in Theory

Do Code Smells Hamper Novice Programming?

Posted Aug 14, 2016 by Greg Wilson

| Novices | Code Smells |

Felienne Hermans and Efthimia Aivaloglou: "Do Code Smells Hamper Novice Programming?" TUD-SERG-2016-006, 2016.

Recently, block-based programming languages like Alice, Scratch and Blockly have become popular tools for programming education. There is substantial research showing that block-based languages are suitable for early programming education. But can block-based programs be smelly too? And does that matter to learners?

In this paper we explore the code smells metaphor in the context of block-based programming language Scratch. We conduct a controlled experiment with 61 novice Scratch programmers, in which we divided the novices into three groups. One third receive a non-smelly program, while the other groups receive a program suffering from the Duplication or the Long Method smell respectively. All subjects then perform the same comprehension tasks on their program, after which we measure their time and correctness.

The results of the experiment show that code smell indeed influence performance: subjects working on the program exhibiting code smells perform significantly worse, but the smells did not affect the time subjects needed. Investigating different types of tasks in more detail, we find that Long Method mainly decreases system understanding, while Duplication decreases the ease with which subjects modify Scratch programs.

I'm a big fan of block-based programming languages, and an even bigger fan of testing whether things that everyone knows are actually true. This paper was therefore a double pleasure—triple if you count the care with which the different effects of long methods and code duplication were teased apart. If the authors made their raw data available, this would be an excellent paper for students to work through in order to learn how studies of this kind should be done.

Comments powered by Disqus