Improving Readability of Scratch Programs with Search-based Refactoring

08/16/2021
by   Felix Adler, et al.
0

Block-based programming languages like Scratch have become increasingly popular as introductory languages for novices. These languages are intended to be used with a "tinkering" approach which allows learners and teachers to quickly assemble working programs and games, but this often leads to low code quality. Such code can be hard to comprehend, changing it is error-prone, and learners may struggle and lose interest. The general solution to improve code quality is to refactor the code. However, Scratch lacks many of the common abstraction mechanisms used when refactoring programs written in higher programming languages. In order to improve Scratch code, we therefore propose a set of atomic code transformations to optimise readability by (1) rewriting control structures and (2) simplifying scripts using the inherently concurrent nature of Scratch programs. By automating these transformations it is possible to explore the space of possible variations of Scratch programs. In this paper, we describe a multi-objective search-based approach that determines sequences of code transformations which improve the readability of a given Scratch program and therefore form refactorings. Evaluation on a random sample of 1000 Scratch programs demonstrates that the generated refactorings reduce complexity and entropy in 70.4 one metric without making any other metric worse. The refactored programs can help both novices and their teachers to improve their code.

READ FULL TEXT

page 1

page 5

page 8

page 9

page 10

page 12

page 13

research
02/15/2021

LitterBox: A Linter for Scratch Programs

Creating programs with block-based programming languages like Scratch is...
research
08/29/2022

Common Patterns in Block-Based Robot Programs

Programmable robots are engaging and fun to play with, interact with the...
research
09/09/2020

Search-based Testing for Scratch Programs

Block-based programming languages enable young learners to quickly imple...
research
08/16/2021

Data-driven Analysis of Gender Differences and Similarities in Scratch Programs

Block-based programming environments such as Scratch are an essential en...
research
09/14/2021

Searching for More Efficient Dynamic Programs

Computational models of human language often involve combinatorial probl...
research
02/15/2021

Finding Anomalies in Scratch Assignments

In programming education, teachers need to monitor and assess the progre...
research
02/13/2022

Model-based Testing of Scratch Programs

Learners are often introduced to programming via dedicated languages suc...

Please sign up or login with your details

Forgot password? Click here to reset