2021 · 11 citations · 34 references
ComputingComputer ScienceCompilersProgramming LanguagesSoftware EngineeringCode GenerationSoftware ConstructionSoftware DesignSoftware RefactoringAbstractionAbstraction MechanismsAutomated RefactoringCode Quality ImprovementControl StructuresMulti-objective EvaluationRandom SamplingScratch Programming
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% of the cases, and 354 projects are improved in at least one metric without making any other metric worse. The refactored programs can help both novices and their teachers to improve their code.
34
Refactoring improving the design of existing code
Mauricio A. Saca · 2017 · 2.1K citations
The Scratch Programming Language and Environment
John Maloney, Mitchel Resnick, Natalie Rusk et al. · ACM Transactions on Computing Education · 2010 · 1.4K citations
A survey of software refactoring
Tom Mens, Tom Tourwé · IEEE Transactions on Software Engineering · 2004 · 1.2K citations · Full text
Michael O’Neill, Conor Ryan · IEEE Transactions on Evolutionary Computation · 2001 · 950 citations