Improving Readability of Scratch Programs with Search-based Refactoring
Felix Adler, Gordon Fraser, Eva Gründinger, Nina Körber, Simon Labrenz, Jonas Lerchenberger, Stephan Lukasczyk, Sebastian Schweikl
备注:
To be published in the Proceedings of the 21st IEEE International Working Conference on Source Code Analysis and Manipulation (SCAM'21). This version includes an extended appendix with transformation examples
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.
Refactoring for Novices in Java: An Eye Tracking Study on the Extract vs. Inline Methods
State University of Paraíba (UEPB)(帕拉伊巴州立大学);Federal University of Campina Grande (UFCG)(坎皮纳格兰德联邦大学);Federal University of Alagoas (UFAL)(阿拉戈阿斯联邦大学);University of Brasília (UnB)(巴西利亚大学);Pontifical Catholic University of Rio de Janeiro(里约热内卢天主教大学)
SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoring
Shanghai Jiao Tong University(上海交通大学);Peking University(北京大学);The Hong Kong University of Science and Technology(香港科技大学);Douyin Group(抖音集团);University of Chinese Academy of Sciences(中国科学院大学);National University of Singapore(新加坡国立大学);Monash University(莫纳什大学)