Code Cloning and Procedural Abstraction in Scratch: A Large-Scale Study of Co-Existing Reuse Practices
Ricardo Hidalgo-Aragon, Jesús Moreno-León, Alejandro Echaniz, David Roldán-Álvarez, Jesús M. González-Barahona, Gregorio Robles
Abstract
Code cloning is a long-standing software-evolution concern: duplicated implementations diverge as software changes. In block-based programming, however, duplication is an everyday reuse mechanism, and Scratch facilitates a copy-and-paste culture that may hinder abstraction. We study this relation in 2.04 million public Scratch projects. We compare cloned sequences with existing abstractions and examine how their use varies across Computational Thinking (CT) score levels. Clones occur in 6.2% of projects and custom blocks in 11.9%. Of 436,198 detected clone instances, 16.1% have a normalized sequence matching a custom block in the same project and 17.8% match a custom block only outside it. At the pattern level, 83 of the 100 most frequent clone patterns have counterparts implementable as custom blocks elsewhere in the corpus. Of the remaining 17 patterns, 15 are amenable to custom-block extraction, while in two cases the benefit of abstraction is ambiguous; no class of frequent clone resists abstraction in principle. Yet the abstractions that do exist are often shallow: 53.0% of custom blocks are parameter-free. Increased use of abstraction does not coincide with less cloning. Both become more prevalent at higher CT-score levels, and their combined use dominates the highest band. These findings are consistent with cloning and procedural abstraction being co-existing reuse practices rather than mutually exclusive stages. Closing that gap requires both instruction on when to abstract, not only how, and platform support for refactoring.
Create a lesson
Metadata
- Comments
- Accepted at BENEVOL 2026 - https://benevol.github.io/2026/
Related papers
Testing with Coding Agents: A Large-Scale Comparison of Agent-Supported and Human-Authored Pull Requests
Shared title terminologycs.SERoberto Milanese, Francesco Salzano, Hovhannes Muradyan et al.
How Developers Configure LLM Inference: A Large-Scale Study of Real-World Practices
Shared title terminologycs.SENada Zine, Matias Martinez, Romain Rouvoy et al.
Barriers to GenAI Integration During Large-Scale Agile Transformation: An Exploratory Case Study
Shared title terminologycs.SENils Brede Moe, Marthe Berntzen, Astri Barbala et al.
Large-Scale Study of GitHub Copilot Trajectories
Shared title terminologycs.SEIzah Sohail, Yerdanat Kurmantayev, May Mahmoud et al.
From Code Review Comments to Reuse in Production: An Industrial Study of Extracted Rules
Shared title terminologycs.SEMutsuha Asada, Yuhei Nakasaka, Keito Tabuchi et al.
Systematic Mapping Protocol. Generative AI-Augmented Requirements Engineering: A Systematic Mapping Study of Practices, Specifications, and Reuse in Software Development
Shared title terminologycs.SEFernando Pinciroli