Common Patterns in Block-Based Robot Programs Article Swipe
YOU?
·
· 2022
· Open Access
·
· DOI: https://doi.org/10.1145/3556787.3556859
· OA: W4293825507
Programmable robots are engaging and fun to play with, interact with the real\nworld, and are therefore well suited to introduce young learners to\nprogramming. Introductory robot programming languages often extend existing\nblock-based languages such as Scratch. While teaching programming with such\nlanguages is well established, the interaction with the real world in robot\nprograms leads to specific challenges, for which learners and educators may\nrequire assistance and feedback. A practical approach to provide this feedback\nis by identifying and pointing out patterns in the code that are indicative of\ngood or bad solutions. While such patterns have been defined for regular\nblock-based programs, robot-specific programming aspects have not been\nconsidered so far. The aim of this paper is therefore to identify patterns\nspecific to robot programming for the Scratch-based mBlock programming\nlanguage, which is used for the popular mBot and Codey Rocky robots. We\nidentify: (1) 26 bug patterns, which indicate erroneous code; (2) three code\nsmells, which indicate code that may work but is written in a confusing or\ndifficult to understand way; and (3) 18 code perfumes, which indicate aspects\nof code that are likely good. We extend the LitterBox analysis framework to\nautomatically identify these patterns in mBlock programs. Evaluated on a\ndataset of 3,540 mBlock programs, we find a total of 6,129 instances of bug\npatterns, 592 code smells and 14,495 code perfumes. This demonstrates the\npotential of our approach to provide feedback and assistance to learners and\neducators alike for their mBlock robot programs.\n