Closing the Block-to-Text Gap: A Domain-Specific JavaScript Editor for Early Computational Thinking

Andrei Enea · 2025

Read Closing the Block-to-Text Gap: A Domain-Specific JavaScript Editor for Early Computational Thinking by Andrei Enea (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2512-00012.txt.

Introduction

Andrei Enea introduces Painting with Code, an editor that eases children from block coding to real text code. The jump from dragging blocks to typing syntax is a known hurdle in school computer science, especially for children aged eight to ten. Many learners stall exactly at that transition.

The web-based editor uses authentic JavaScript syntax, but wraps it in a simple drawing library. Each line of code gives immediate artistic feedback on screen. Learning syntax through drawing keeps motivation high while the code stays real. A simplified, function-based drawing library keeps the first steps gentle while the syntax itself stays fully authentic.

Catalog record

CREATORAndrei Enea
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE27 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2512-00012

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Closing the Block-to-Text Gap: A Domain-Specific JavaScript Editor for Early Computational Thinking Andrei Enea Abstract The transition from block-based to text-based programming poses a significant challenge in K–12 computer science education, particularly for children aged 8–10. This paper introduces Painting with Code , a web-based creative drawing editor that bridges this gap by integrating authentic JavaScript syntax with immediate artistic visual feedback through a simplified, function-based drawing library (domain-specific language, DSL). This approach minimizes syntax-related cognitive load, enabling young learners to focus on core computational concepts. We describe the system’s design and evaluate its efficacy through a four-week pilot study with 15 participants ( N = 15 N=15 ). Quantitative results show a significant improvement in computational thinking skills, with mean Computational Thinking Concept Inventory (CTCI) scores rising from 14.3 ​ ( ± 1.1 ) 14.3(\pm 1.1) to 25.2 ​ ( ± 1.3 ) 25.2(\pm 1.3) out of 30 ( p < 0.001 p<0.001 ). Qualitative observations indicate rapid progression from basic function calls to sophisticated algorithms, including nested loops and conditionals, to create complex geometric artworks. This research contributes a validated, visual-first framework that transforms abstract programming concepts into engaging, artistic outputs, facilitating the block-to-text transition for novice learners. Keywords : JavaScript Education, Child Programming, Block-to-Text Transition, Visual Programming, Computational Thinking, K–12 Education, Domain-Specific Language 1 Introduction Computational thinking (CT) is a cornerstone of modern education, equipping students with problem-solving skills that transcend computer science and apply to diverse fields such as mathematics, science, and the arts [ 23 , 7 ] . In K–12 settings, block-based programming environments like Scratch [ 16 ] and Blockly have lowered barriers to entry by allowing young learners to construct programs through intuitive drag-and-drop interfaces, fostering engagement and creativity without the burden of syntax errors [ 12 , 3 ] . However, as students progress to text-based languages like JavaScript or Python, they encounter the block-to-text gap —a well-documented challenge characterized by syntax complexity, abstract program structures, and error messages that can overwhelm novices [ 9 , 22 , 1 ] . This transition often leads to frustration, diminished confidence, and disengagement, particularly for children aged 8–10, who are at a critical developmental stage for building computational fluency [ 11 , 17 ] . To address this gap, we developed Painting with Code , a web-based JavaScript editor tailored for young learners. Unlike general-purpose programming environments like p5.js [ 15 ] or Code.org, which often target older students or broader curricula, Painting with Code uses a domain-specific language (DSL) focused on visual art to provide immediate, tangible feedback. By constraining JavaScript to a simplified set of drawing functions, the tool reduces cognitive load [ 19 ] , enabling students to focus on core CT concepts like abstraction, iteration, and conditionals while creating expressive geometric artworks. This approach aligns with constructionist principles, where learning is driven by creating personally meaningful artifacts [ 14 , 4 ] . This paper contributes a novel pedagogical framework that bridges the block-to-text gap by combining authentic text-based programming with a visual-first, creative context. Through a four-week pilot study with 15 children aged 8–10, we demonstrate that Painting with Code significantly enhances CT skills and fosters engagement. The paper is structured as follows: • System Design : Describes the architecture and DSL of Painting with Code . • Methodology : Details the pilot study, including participants, curriculum, and evaluation methods. • Results : Presents quantitative improvements in CT scores and qualitative insights into student creativity. • Discussion : Analyzes findings in the context of prior work, educational implications, and future directions. By validating a DSL-based, visual-first approach, this work offers educators a practical tool to ease the transition to text-based programming, paving the way for more inclusive and engaging K–12 computer science education. 2 Related Work 2.1 Block-Based Programming Block-based environments, such as Scratch [ 16 ] and Blockly, enable novices to explore concepts like loops, conditionals, and events without syntactic hurdles. These tools have proven effective in building foundational CT skills in K–12 settings [ 12 , 2 , 3 , 10 ] . The primary strength of block programming lies in its low threshold for entry, allowing young students to focus on logic and sequencing. 2.2 Domain-Specific Languages in Education Domain-specific languages (DSLs) offer task-specific, simplified interfaces that accelerate learning by constraining complexity and providing rapid feedback. By focusing on a narrow problem space (in this case, drawing), DSLs act as cognitive offloaders, allowing learners to master core computational structures before grappling with the vast, general-purpose syntax of languages like standard JavaScript. Educational DSLs have been shown to promote algorithmic thinking while introducing text-based syntax gradually [ 7 , 6 , 8 ] . Our work builds on this principle, using a minimal drawing DSL to introduce authentic JavaScript text. 2.3 Scaffolding the Block-to-Text Transition Studies consistently highlight the difficulties novices face in the transition from visual blocks to textual code, including increased error rates and diminished engagement when suddenly confronted with strict syntax rules [ 9 , 20 , 1 , 22 ] . This transition requires careful scaffolding—a process of providing temporary support that is gradually withdrawn as the learner’s proficiency increases. Recent research has explored several scaffolding strategies: • Direct Translation Tools: Environments that show block code and the corresponding text code side-by-side. While helpful for mapping, these often fail to address the underlying conceptual shift from drag-and-drop to typing and debugging [ 21 ] . • Structured Editors: Tools that limit the ways code can be typed or autocompleted to prevent certain syntax errors, easing the shock of moving to a full text editor [ 9 ] . • Visual Text Environments: Platforms like Processing (Java/Python) and its JavaScript port, p5.js, use a core graphics library to engage students with code through creative visual output. These environments have been highly successful in college and high school settings by framing programming as a medium for creative expression [ 15 , 13 ] . Painting with Code distinguishes itself from general-purpose environments like p5.js by targeting a much younger demographic (8–10 years old) and further reducing the cognitive load. Our custom Domain-Specific JavaScript Editor serves as a specialized, highly constrained visual text environment. It employs fewer, highly intuitive functions and a fixed coordinate system, effectively creating a zone of proximal development where authentic text-based programming is manageable and immediately rewarding for early learners. 3 System Design: Painting with Code 3.1 Overview Painting with Code is a single-page web application built using JavaScript, HTML5 Canvas, and CSS. It features a side-by-side text editor and live canvas for instantaneous rendering of code outputs, minimizing distractions with a clean interface. The tool is publicly accessible at https://informaticasite.com/painting-with-code/index.html , with function references at https://informaticasite.com/painting-with-code/shapes.html . Key features include: • DSL with 15 abstracted drawing functions (Table 1 ). • Support for loops, conditionals, variables, arithmetic, and animations via requestAnimationFrame. • Random color generation and geometric primitives to encourage artistic exploration. 3.2 Domain-Specific Language (DSL) The DSL abstracts HTML5 Canvas API complexities into intuitive functions, enabling students to prioritize logic over implementation details. Table 1 lists the functions with descriptions and examples. Table 1: DSL Functions for Painting with Code Function Description Example drawCircle Draw a filled circle drawCircle

Read the complete text