Improving Readability of Scratch Programs with Search-based Refactoring

被引:7
|
作者
Adler, Felix [1 ]
Fraser, Gordon [1 ]
Gruendinger, Eva [1 ]
Koerber, Nina [1 ]
Labrenz, Simon [1 ]
Lerchenberger, Jonas [1 ]
Lukasczyk, Stephan [1 ]
Schweikl, Sebastian [1 ]
机构
[1] Univ Passau, Passau, Germany
关键词
Search-Based Refactoring; Scratch; Readability; SOFTWARE;
D O I
10.1109/SCAM52516.2021.00023
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页码:120 / 130
页数:11
相关论文
共 50 条
  • [1] Search-based refactoring: an empirical study
    O'Keeffe, Mark
    Cinneide, Mel O.
    JOURNAL OF SOFTWARE MAINTENANCE AND EVOLUTION-RESEARCH AND PRACTICE, 2008, 20 (05): : 345 - 364
  • [2] Challenges Classification in Search-Based Refactoring
    Shafiei, Narjes
    Keyvanpour, Mohammad Reza
    2020 6TH INTERNATIONAL CONFERENCE ON WEB RESEARCH (ICWR), 2020, : 106 - 112
  • [3] Search-based refactoring for software maintenance
    O'Keeffe, Mark
    Cinneide, Mel O.
    JOURNAL OF SYSTEMS AND SOFTWARE, 2008, 81 (04) : 502 - 516
  • [4] A systematic review on search-based refactoring
    Mariani, Thaina
    Vergilio, Silvia Regina
    INFORMATION AND SOFTWARE TECHNOLOGY, 2017, 83 : 14 - 34
  • [5] Local Search-Based Refactoring as Graph Transformation
    Qayum, Fawad
    Heckel, Reiko
    1ST INTERNATIONAL SYMPOSIUM ON SEARCH BASED SOFTWARE ENGINEERING, PROCEEDINGS, 2009, : 43 - 46
  • [6] Getting the Most from Search-Based Refactoring
    O'Keeffe, Mark
    Cinneide, Mel O.
    GECCO 2007: GENETIC AND EVOLUTIONARY COMPUTATION CONFERENCE, VOL 1 AND 2, 2007, : 1114 - 1120
  • [7] Search-based Refactoring: Towards Semantics Preservation
    Ouni, Ali
    Kessentini, Marouane
    Sahraoui, Houari
    Hamdi, Mohamed Salah
    2012 28TH IEEE INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE (ICSM), 2012, : 347 - 356
  • [8] Search-based Refactoring Using Recorded Code Changes
    Ouni, Ali
    Kessentini, Marouane
    Sahraoui, Houari
    PROCEEDINGS OF THE 17TH EUROPEAN CONFERENCE ON SOFTWARE MAINTENANCE AND REENGINEERING (CSMR 2013), 2013, : 221 - 230
  • [9] Model refactoring using examples: a search-based approach
    Ghannem, Adnane
    El Boussaidi, Ghizlane
    Kessentini, Marouane
    JOURNAL OF SOFTWARE-EVOLUTION AND PROCESS, 2014, 26 (07) : 692 - 713
  • [10] Interactive and Guided Architectural Refactoring with Search-Based Recommendation
    Lin, Yun
    Peng, Xin
    Cai, Yuanfang
    Dig, Danny
    Zheng, Diwen
    Zhao, Wenyun
    FSE'16: PROCEEDINGS OF THE 2016 24TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON FOUNDATIONS OF SOFTWARE ENGINEERING, 2016, : 535 - 546