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.


翻译:Scratch 等基于街区的编程语言越来越受欢迎,成为新手的入门语言。这些语言的用意是使用一种“牵引”方法,使学习者和教师能够快速组合工作程序和游戏,但这往往导致代码质量低。这种代码很难理解,改变容易出错,学习者可能会挣扎和失去兴趣。提高代码质量的一般解决办法是重新构筑代码。然而,Scratch 缺乏许多用于重构以更高编程语言编写的程序所用的共同抽象机制。为了改进拼写代码,我们因此提出一套原子代码转换以优化可读性,方法是:(1) 重写控制结构,(2) 简化脚本,使用Scratch 程序固有的并行性质。通过这些转换的自动化,可以探索Scratch 程序可能的变换空间。在本文中,我们描述了一种多目标的基于搜索的方法,确定代码转换的顺序,从而改进了某个特定编程的编程的可读性,因此,我们因此提出了一套最不易读化的代码。 在一个随机样本中,对一个更糟糕的编程的编程中,对一个重的编程进行评方案进行了评估。

0
下载
关闭预览

相关内容

一个旨在提升互联网阅读体验的工具。 readability.com/
《概率统计及其在计算中的应用》书册,384页pdf
专知会员服务
45+阅读 · 2021年1月7日
专知会员服务
39+阅读 · 2020年9月6日
知识图谱推理,50页ppt,Salesforce首席科学家Richard Socher
专知会员服务
105+阅读 · 2020年6月10日
【经典书】贝叶斯编程,378页pdf,Bayesian Programming
专知会员服务
246+阅读 · 2020年5月18日
FlowQA: Grasping Flow in History for Conversational Machine Comprehension
专知会员服务
28+阅读 · 2019年10月18日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
强化学习最新教程,17页pdf
专知会员服务
174+阅读 · 2019年10月11日
Call for Participation: Shared Tasks in NLPCC 2019
中国计算机学会
5+阅读 · 2019年3月22日
Msfvenom 常用生成 Payload 命令
黑白之道
9+阅读 · 2019年2月23日
逆强化学习-学习人先验的动机
CreateAMind
15+阅读 · 2019年1月18日
TCN v2 + 3Dconv 运动信息
CreateAMind
4+阅读 · 2019年1月8日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
条件GAN重大改进!cGANs with Projection Discriminator
CreateAMind
8+阅读 · 2018年2月7日
计算机视觉近一年进展综述
机器学习研究会
9+阅读 · 2017年11月25日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
Arxiv
4+阅读 · 2018年5月24日
Arxiv
5+阅读 · 2018年3月16日
VIP会员
相关VIP内容
《概率统计及其在计算中的应用》书册,384页pdf
专知会员服务
45+阅读 · 2021年1月7日
专知会员服务
39+阅读 · 2020年9月6日
知识图谱推理,50页ppt,Salesforce首席科学家Richard Socher
专知会员服务
105+阅读 · 2020年6月10日
【经典书】贝叶斯编程,378页pdf,Bayesian Programming
专知会员服务
246+阅读 · 2020年5月18日
FlowQA: Grasping Flow in History for Conversational Machine Comprehension
专知会员服务
28+阅读 · 2019年10月18日
Stabilizing Transformers for Reinforcement Learning
专知会员服务
57+阅读 · 2019年10月17日
强化学习最新教程,17页pdf
专知会员服务
174+阅读 · 2019年10月11日
相关资讯
Call for Participation: Shared Tasks in NLPCC 2019
中国计算机学会
5+阅读 · 2019年3月22日
Msfvenom 常用生成 Payload 命令
黑白之道
9+阅读 · 2019年2月23日
逆强化学习-学习人先验的动机
CreateAMind
15+阅读 · 2019年1月18日
TCN v2 + 3Dconv 运动信息
CreateAMind
4+阅读 · 2019年1月8日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
条件GAN重大改进!cGANs with Projection Discriminator
CreateAMind
8+阅读 · 2018年2月7日
计算机视觉近一年进展综述
机器学习研究会
9+阅读 · 2017年11月25日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
Top
微信扫码咨询专知VIP会员