Next Article in Journal
Estimating Brain Health from Facial Expressions: An Exploratory Study
Next Article in Special Issue
Assessment of Learning Through Educational Video Games in Preservice Teacher Education
Previous Article in Journal
Digital Frontline: An AI Role-Play Simulation of IT Support Crises in the Implementation of Agile-Blended Learning
Previous Article in Special Issue
A Survey on the Use of Online Health Videos in Medical Education: Insights from Mozambican Students
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Using Code Comments as a Pedagogical Scaffold in Digitally Supported Introductory Programming: An Exploratory Mixed-Methods Study in Vocational Secondary Education

by
Gonçalo Sarmento
1 and
Manuel J. C. S. Reis
2,*
1
Escola de Ciências Humanas e Sociais, Universidade de Trás-os-Montes e Alto Douro, 5000-801 Vila Real, Portugal
2
Departamento de Engenharias & IEETA, Escola de Ciências e Tecnologia, Universidade de Trás-os-Montes e Alto Douro, 5000-801 Vila Real, Portugal
*
Author to whom correspondence should be addressed.
Digital 2026, 6(2), 37; https://doi.org/10.3390/digital6020037
Submission received: 18 March 2026 / Revised: 23 April 2026 / Accepted: 6 May 2026 / Published: 8 May 2026
(This article belongs to the Collection Multimedia-Based Digital Learning)

Abstract

The development of computational thinking in introductory programming remains a major challenge, particularly in vocational secondary education, where students frequently encounter difficulties in understanding code structure, identifying errors, and translating problem statements into algorithmic solutions. This study examines the use of code comments as a pedagogical scaffold within a digitally supported learning environment enriched with multimodal instructional resources for novice programming students. An exploratory mixed-methods classroom intervention was conducted in a vocational secondary education context, combining comment-centered coding activities with digital educational resources such as online forms, classroom management tools, guided worksheets, interactive exercises, and feedback-oriented learning tasks. The intervention was examined through a pre- and post-test on computational thinking, a pre- and post-intervention questionnaire on students’ knowledge, practices, and perceptions regarding code comments, and supporting qualitative evidence from classroom artifacts. The findings showed a marked improvement in computational thinking performance over the course of the intervention, with the mean test score increasing from 43% to 91%. Students also reported more positive and more elaborated views regarding the role of code comments in code comprehension, debugging, organization, and learning support. Given the single-group design and small sample, these results should be interpreted as exploratory and context-specific rather than as evidence of intervention-only causality. Nevertheless, the study provides practice-based evidence that code comments, when embedded in a structured multimedia-supported learning design, may function as a useful pedagogical scaffold in introductory programming education. This study contributes empirical evidence from an underrepresented vocational secondary education setting and offers actionable implications for multimedia-based digital learning in computer science education.

1. Introduction

Teaching introductory programming continues to be a persistent challenge across educational contexts, particularly for novice learners who must simultaneously develop syntactic fluency, semantic understanding, algorithmic reasoning, and debugging strategies. Although programming is now widely recognized as a foundational component of digital literacy and computer science education, students in early programming courses frequently struggle to interpret code, construct coherent solutions, and articulate the logic underlying their programs. Recent evidence suggests that these difficulties remain especially pronounced during code composition, where novices often experience problems related to planning, sequencing, and translating intentions into executable code [1]. More broadly, reviews of programming education continue to highlight persistent barriers such as abstraction, debugging, syntax, and problem decomposition, all of which can negatively affect engagement and learning outcomes [2,3].
In parallel with these longstanding challenges, computational thinking (CT) has become a central construct in contemporary digital education. Since Wing’s seminal formulation of CT as a fundamental analytical competence extending beyond computer science [4,5], the concept has evolved into a broad educational priority associated with problem decomposition, pattern recognition, abstraction, algorithmic design, and debugging. More recent scholarship has emphasized that CT should not be reduced to mere coding performance, but instead understood as a broader cognitive and epistemic framework for structured problem solving in digital contexts [6]. At the K–12 level, research reviews confirm that CT and programming have become increasingly intertwined in curriculum design and educational research, yet they also show substantial variation in how CT is operationalized, taught, and assessed [3,7].
This growing interest in CT has been accompanied by a parallel expansion in research on instructional strategies that can support novice programmers, especially within digital and multimedia-enhanced learning environments. In this context, the design of learning activities that scaffold students’ reasoning processes is particularly relevant. Prior work in the learning sciences has consistently shown that self-explanation is one of the most robust mechanisms for promoting generative learning, deeper comprehension, and transfer, especially when learners are prompted to explain steps, decisions, or relationships rather than merely reproduce solutions [8]. In programming education, self-explanation has similarly been associated with improved code comprehension and more meaningful engagement with worked examples and problem-solving tasks [9,10].
One particularly promising—but still underexplored—way of operationalizing self-explanation in programming instruction is through the intentional use of code comments. While comments are traditionally discussed in software engineering in relation to documentation, maintainability, and code quality, they can also be reconceptualized pedagogically as a form of embedded explanation that makes reasoning visible during code reading and code writing. This pedagogical interpretation is supported by a line of work led by Vieira and colleagues, who showed that writing in-code comments as self-explanations can help students connect program structure to disciplinary and computational concepts, increase awareness of worked examples, and foster more reflective engagement with code [11,12,13]. Their studies suggest that comments can function not merely as annotations, but as a lightweight and integrable scaffold for making students’ reasoning explicit during learning.
More recent work also supports the educational relevance of comments and code explanation in early programming contexts. For example, Kerschbaumer et al. [14] reported an association between students’ source-code comment behavior and academic success in a CS1 context, reinforcing the view that commenting practices may be related to deeper engagement with program structure. Similarly, contemporary work on code quality in CS1 has argued that early programming instruction should address not only functional correctness, but also readability, explanation, and maintainability-related practices that help students reason about code more explicitly [15,16]. In parallel, emerging research on code explanation activities in introductory programming continues to highlight that many students can produce working code without being able to clearly explain it, which suggests the presence of fragile or superficial learning [17].
At the same time, research from software engineering provides an additional rationale for bringing comments into the classroom. Studies on code understandability and comment quality indicate that explanatory artifacts—including comments, naming, and structural clarity—play an important role in how programmers interpret, review, and maintain code [18,19]. Although these studies are not primarily pedagogical, they reinforce the educational value of cultivating explanatory coding habits from the beginning of programming instruction, especially when the goal is not only to “make code run” but to help learners develop organized, communicable, and inspectable computational reasoning.
Despite this promise, there is still a notable gap in the literature. Much of the existing work on comments as self-explanation or on code explanation practices has been conducted in higher education, particularly in engineering or CS1 university settings. In contrast, there is comparatively less empirical evidence on how such strategies function in vocational secondary education, even though this context is especially important for developing applied digital competences and workplace-relevant programming practices. Recent work in vocational education and training (VET) has emphasized the growing importance of CT and digital problem-solving for employability and technological adaptation, while also noting that research in this area remains relatively limited and fragmented [20]. This gap is particularly relevant because vocational learners often engage with programming in strongly practice-oriented settings, where low-cost, high-impact scaffolds may be especially valuable.
The present study addresses this gap by examining the role of code comments as a digital pedagogical scaffold in an introductory programming course taught in vocational secondary education. Rather than treating comments only as a technical convention, this study conceptualizes them as a structured instructional strategy embedded in a broader digital learning environment that included guided worksheets, classroom management platforms, online forms, and feedback-oriented tasks. The intervention was designed to support novice learners in reading code, organizing algorithmic reasoning, identifying errors, and articulating the logic of their own solutions. In doing so, this study connects three strands of research that are often treated separately: (i) computational thinking development, (ii) scaffolding and self-explanation in programming education, and (iii) digitally supported pedagogical design.
Importantly, the gap addressed here is not only contextual but also pedagogical. Although comments are widely recognized in software engineering as tools for documentation and maintainability, fewer studies have examined them as deliberately structured instructional supports designed to prompt reflection, explanation, and explicit reasoning during early programming learning. This distinction matters because novice learners may be able to reproduce code syntactically without developing robust conceptual understanding. In this sense, the present study is positioned not merely as an application of an existing technique to a different population, but as an investigation of how a lightweight explanatory practice can function as a pedagogical scaffold in a practice-oriented and underrepresented educational setting.
Empirically, the study adopts a mixed-methods pre-/post-intervention design to investigate whether a comment-centered instructional approach is associated with measurable changes in students’ computational thinking performance and in their perceptions of the usefulness of code comments. This dual focus is important because the educational value of comments may lie not only in improved test performance, but also in helping students internalize more reflective and organized ways of approaching code. In the context of the present intervention, students showed substantial improvement between pre- and post-assessment, with the mean computational thinking score increasing from 43% to 91%, while questionnaire responses also indicated more positive perceptions of comments as tools for code comprehension, debugging, and organization. These findings motivated the present article’s central argument: that code comments, when intentionally integrated into a structured digital learning design, can serve as an effective pedagogical scaffold for novice programmers in vocational secondary education.
Accordingly, this article aims to investigate the pedagogical role of code comments in introductory programming and their relationship to the development of computational thinking in a vocational secondary education context. More specifically, it addresses the following research questions:
  • RQ1. To what extent does a comment-centered pedagogical intervention improve students’ computational thinking performance in introductory programming?
  • RQ2. How do students’ perceptions of the usefulness of code comments change after participating in the intervention?
  • RQ3. How can code comments, when embedded in a digitally supported instructional design, function as a pedagogical scaffold for novice programmers in vocational secondary education?
This article makes three main contributions. First, it provides empirical evidence from an underrepresented educational context, namely vocational secondary programming education. Second, it extends prior research on code comments as self-explanation by examining their use in a classroom intervention explicitly connected to computational thinking outcomes. Third, it contributes to the literature on multimedia-based digital learning by showing how a simple, low-cost instructional practice can gain pedagogical power when integrated into a structured digital learning environment.

2. Theoretical Background

2.1. Computational Thinking in Introductory Programming Education

Computational thinking (CT) is now widely recognized as a core competence in contemporary education and as an increasingly important component of digital literacy, problem solving, and technology-mediated reasoning. Although the concept has been interpreted in multiple ways, there is broad agreement that CT encompasses practices such as decomposition, abstraction, pattern recognition, algorithmic design, and debugging, all of which are relevant across disciplines but particularly salient in programming education [4,5,21]. In this sense, CT should not be understood as synonymous with programming itself, but rather as a broader cognitive framework that can be expressed through programming tasks and strengthened through carefully designed learning activities [6].
In introductory programming, the relationship between CT and programming is especially close. Programming environments provide learners with a concrete space in which abstract computational processes must be translated into explicit, testable, and revisable procedures. As a result, novice programmers are often required to engage in CT practices while solving tasks, whether by decomposing a problem into smaller steps, selecting appropriate control structures, tracing execution, or identifying and correcting errors. Recent research reviews confirm that programming remains one of the most common pedagogical vehicles for CT development in school settings, particularly in K–12 and early computing education, even though instructional designs and assessment strategies vary considerably across studies [3,7].
At the same time, the close connection between programming and CT does not imply that all programming instruction automatically develops CT in meaningful ways. Several authors have argued that the educational value of programming depends heavily on the quality of task design, the explicitness of reasoning processes, and the pedagogical support available to students [6,20]. This is particularly relevant in vocational education, where programming is often taught in applied and time-constrained contexts, and where students may benefit from more explicit scaffolds that help them organize reasoning and connect code to practical problem solving. Recent work in vocational education and training (VET) emphasizes that CT should be intentionally integrated rather than assumed to emerge spontaneously from technical activities alone [20].
A substantial body of research also shows that novice programmers face persistent and multifaceted difficulties. These include challenges in understanding the semantics of code, managing syntax and notation, constructing coherent program structures, debugging, and aligning intended solutions with executable logic. While such difficulties have long been recognized in programming education, recent studies continue to show that they remain highly relevant. For instance, Weeda et al. [1] demonstrated that novice learners experience recurring problems in code composition, particularly when coordinating multiple conceptual and syntactic elements during program construction. Similarly, the literature reviews continue to identify abstraction, decomposition, syntax, and debugging as major barriers in introductory programming learning [2].
These challenges are pedagogically significant because they suggest that introductory programming is not merely a matter of transmitting syntax or demonstrating correct solutions. Rather, it requires instructional approaches that make reasoning processes visible and support students in constructing more explicit and organized mental models of how code works. From this perspective, CT in introductory programming should be seen not only as a learning outcome, but also as a process that benefits from scaffolding, especially for learners with limited prior experience. This is particularly relevant in vocational secondary education, where the development of applied digital competences must often coexist with heterogeneous prior knowledge and varying levels of academic confidence.

2.2. Code Comments as Pedagogical Scaffolding

In software development, code comments are traditionally associated with documentation, maintainability, and communication among developers. However, in educational contexts, comments can also serve a distinct and valuable pedagogical function. Rather than being treated solely as technical annotations, they may be conceptualized as a form of embedded explanation that helps learners externalize reasoning, articulate intent, and establish links between program structure and underlying logic. This pedagogical interpretation is especially relevant in introductory programming, where students often produce or imitate code before fully understanding its conceptual organization.
This view aligns closely with broader research on self-explanation and generative learning. In the learning sciences, self-explanation refers to the process by which learners actively generate explanations to make sense of new information, often by clarifying relationships, justifying steps, or connecting ideas to prior knowledge. Such processes have been shown to support deeper comprehension, transfer, and durable learning across multiple domains [8]. In programming education, self-explanation is particularly relevant because code is both a product and a representation of reasoning: understanding a program requires not only reading instructions, but also reconstructing the logic that motivates them.
This interpretation is also consistent with the broader literature on example-based learning and instructional explanation. Foundational studies on self-explanation have shown that learners often benefit when they are encouraged to actively articulate the rationale behind solution steps rather than passively inspect examples, particularly in domains that require structured problem solving and procedural understanding. In this perspective, code comments can be understood as a lightweight written form of prompted self-explanation embedded directly in the programming artifact itself, potentially helping students make otherwise implicit reasoning more explicit and inspectable during both code reading and code writing [8,9,10,11,12,13].
A particularly important line of work in this area is the research by Vieira and colleagues, who explicitly examined the use of in-code comments as a self-explanation strategy in computational science and engineering education. In an early exploratory study [11], showed that students’ comments varied substantially in depth and explanatory quality, with stronger students more often connecting code segments to underlying conceptual goals rather than merely describing surface-level functionality. In a subsequent study, Vieira et al. [13] demonstrated that structured comment-writing activities could help students engage more meaningfully with worked examples and computational models, especially when comments were integrated into guided instructional sequences. Later, Vieira et al. [12] further argued that students’ written explanations can reveal differences in conceptual understanding and provide insight into how learners interpret computational tasks. Taken together, these studies strongly support the view that code comments can function as a pedagogically lightweight yet cognitively meaningful scaffold.
From a pedagogical standpoint, code comments may support learning at both cognitive and metacognitive levels. Cognitively, comments can help students break down a program into meaningful segments, label the purpose of instructions, and connect code lines to algorithmic goals. This can reduce the opacity of code and support comprehension, especially in the early stages of learning. Metacognitively, comments may prompt learners to monitor their own understanding, plan before coding, and reflect on whether a solution actually matches the intended logic. In this sense, comments can be viewed as a bridge between code execution and reflective reasoning, helping students move from “writing code that runs” to “writing code they can explain” [8,9,10,11,12,13,17].
This is particularly relevant for three common dimensions of novice programming performance: readability, debugging, and planning. First, comments can improve readability by making the functional organization of code more explicit, which is especially useful when students revisit their own code after a delay. Second, comments can support debugging by helping learners compare intended behavior with actual implementation, thereby surfacing discrepancies between plan and execution. Third, comments can support planning by encouraging learners to sketch or verbalize the logic of a solution before writing the final code. These functions align with broader software engineering research showing that explanatory artifacts—such as comments, naming, and structural clarity—play an important role in code understandability and maintenance [18,19]. While such studies are not pedagogical per se, they reinforce the educational plausibility of teaching students to use comments as part of a broader culture of understandable code.
At the same time, it is important to distinguish pedagogical comments from professional commenting practices. In authentic software engineering, comments may be sparse, highly contextual, or even discouraged when code is self-explanatory. In educational settings, however, comments can serve a temporary instructional role as a scaffold for learning rather than as a permanent feature of all code. In other words, the educational goal is not to maximize comment density, but to use comments strategically to support code comprehension, structured reasoning, and conceptual articulation during learning. This distinction is important because it clarifies that the present study is not primarily about software documentation quality, but about the instructional value of comments as a scaffold for novice programmers.

2.3. Digital and Multimedia-Supported Learning in Programming Education

The pedagogical value of code comments becomes particularly meaningful when situated within a broader digitally supported learning environment. Introductory programming is increasingly taught through combinations of classroom instruction, online platforms, interactive exercises, auto-graded tasks, forms-based assessments, video or text tutorials, and learning management systems (LMS). In such environments, learning is shaped not only by the content of programming tasks, but also by how resources are sequenced, how feedback is delivered, and how students are prompted to reflect on their work. For this reason, the effectiveness of a strategy such as comment-based scaffolding should be considered in relation to the wider digital ecosystem in which it is embedded [8,9,22].
Recent research in computing education has emphasized the growing importance of digitally mediated instructional design in programming courses. For example, Paiva et al. [22], in a state-of-the-art review of automated assessment in computer science education, showed that digital assessment and feedback systems now play a central role in programming instruction, enabling rapid feedback cycles, diverse exercise formats, and scalable support for learners. Similarly, research on worked examples and structured programming tasks has shown that learning can be enhanced when students interact with carefully sequenced, partially guided, or explicitly explained materials rather than only solving open-ended problems from scratch [9]. These findings are particularly relevant for novice learners, who often benefit from external supports that reduce cognitive overload while maintaining active engagement.
Within this broader landscape, multimedia-supported digital learning can be understood as the integration of multiple representational and interactional supports—such as text, code, prompts, online forms, visual aids, feedback loops, and guided tasks—into a coherent pedagogical design [8,9,22]. In programming education, these supports may include classroom management platforms (e.g., LMS environments), interactive forms for formative assessment, guided worksheets, debugging tasks, code tracing exercises, and scaffolded worked examples [9,22]. What matters pedagogically is not merely the presence of technology, but the extent to which digital resources are used to structure attention, prompt reflection, and make learning processes more visible [8,9].
This perspective aligns with research showing that scaffolding in digital environments is most effective when it is purposeful, integrated, and closely aligned with learning goals [8,9,22]. For novice programmers, digital tools can support learning by providing immediate feedback, repeated access to instructional materials, structured progression across tasks, and opportunities for reflection before, during, and after coding [8,9,22]. When combined with strategies such as comment writing, these affordances may help students build stronger connections between code, intention, and explanation. In this sense, comments are not a standalone technique, but one element of a broader pedagogical architecture that can include guided prompts, formative assessment, and multimodal instructional supports.
This framing is especially relevant for the present study, which was conducted in a vocational secondary education context where teaching and learning were supported by a combination of classroom instruction and digital resources, including guided worksheets, online forms, classroom management tools, and structured feedback-oriented activities. The intervention therefore reflects not only a specific focus on code comments, but also a multimedia-based digital learning design in which comments were used as a central explanatory scaffold within a broader instructional ecosystem. This positioning is important because it allows the study to contribute not only to programming education research, but also to the growing literature on digitally supported and multimedia-enhanced learning in practice-oriented educational settings.
More broadly, the pedagogical rationale for comment-based scaffolding can also be situated within ongoing debates in programming education regarding the balance between minimally guided discovery and more structured forms of support for novice learners. From this perspective, code comments may be understood as a lightweight scaffolding mechanism that reduces unnecessary cognitive burden while preserving active engagement with code, potentially occupying an intermediate position between fully worked examples and unguided problem solving. This framing helps clarify why comment-centered activities may be particularly relevant in vocational secondary education, where learners often benefit from explicit structure without disengaging from authentic programming practice [8,9,23].

3. Materials and Methods

3.1. Research Design

This study adopted a mixed-methods, pre-/post-intervention classroom design to investigate the pedagogical role of code comments in introductory programming and their relationship to the development of computational thinking (CT) among vocational secondary students. More specifically, the study was designed as a single-group exploratory classroom study embedded in an authentic teaching context, combining quantitative and qualitative sources of evidence to examine both learning outcomes and changes in student perceptions [24,25].
The quantitative component consisted of a pre-test/post-test comparison based on two instruments administered before and after the intervention: (i) a computational thinking test and (ii) a questionnaire on students’ knowledge, practices, and perceptions regarding the use of code comments. The qualitative component was based on classroom-produced artifacts—particularly the structured worksheets completed during the intervention—and on the interpretive analysis of students’ evolving responses concerning the pedagogical value of comments. This combination of measures allowed the study to examine not only whether performance improved, but also how students’ understanding of code comments appeared to evolve during the intervention.
Given the small sample size and the real-world classroom context, the study should be understood as an exploratory practice-based intervention rather than as a controlled experimental design. No separate control group was used. Instead, the study aimed to generate ecologically valid evidence regarding the feasibility and potential pedagogical value of a comment-centered instructional strategy in vocational secondary education. This design is consistent with the logic of classroom-based educational research, where instructional innovation is often studied under natural teaching conditions and interpreted with appropriate caution.

3.2. Context and Participants

The study was conducted during the 2024/2025 academic year at Camilo Castelo Branco Secondary School (Escola Secundária Camilo Castelo Branco—ESCCB), located in Vila Real, Portugal, within the context of a supervised teaching practice in the Master’s Degree in Computer Science Teaching at the University of Trás-os-Montes e Alto Douro. The broader teaching practice involved observation and teaching activities across multiple vocational secondary classes; however, the present study focused specifically on one target class used for the research intervention.
The intervention was implemented in a 10th-grade vocational secondary class enrolled in the Technical Course in Management Informatics (Técnico de Informática de Gestão; TIG), in the subject Programming Languages. The target class comprised 10 enrolled students, all of whom participated in the classroom intervention and completed both the pre- and post-intervention data collection procedures. The group included 7 male and 3 female students, and two students were identified as having special educational needs (SEN/NEE) within the school’s inclusive education framework. This group reflects a typical small vocational secondary classroom, characterized by heterogeneous prior knowledge, differing levels of confidence in programming, and a strongly practice-oriented curricular profile.
The broader teaching practice extended from 21 October 2024 to 27 March 2025, covering the first two academic terms up to the beginning of the students’ curricular internship period. During this period, the teacher-researcher observed 51 classes, taught 132 classes, and participated in 10 cooperative school activities. While the intervention described in this article corresponds to a specific subset of this broader teaching period, it was developed within this sustained classroom immersion, which contributed to a detailed understanding of students’ learning profiles, difficulties, and response patterns.
From a curricular perspective, the study took place in a vocational secondary education setting, which is particularly relevant because programming in this context is closely connected to applied digital competences and employability-oriented learning. The instructional environment therefore emphasized practical problem solving, guided exercises, and progressively autonomous coding tasks. This context is important to the interpretation of the findings, since the pedagogical value of code comments may differ in vocational settings compared with more theory-driven academic environments.
All students in the class participated in the pedagogical activities that formed part of the intervention. The quantitative analyses reported in this study are based on the students who completed both the pre- and post-intervention administrations of the computational thinking test and the questionnaire on code comments (n = 10). Because the study was conducted in a natural classroom setting as part of regular teaching practice, no separate control group was used; the study should therefore be interpreted as an exploratory classroom-based intervention in an ecologically valid vocational education context.

3.3. Pedagogical Intervention

The pedagogical intervention was designed around the systematic and guided use of code comments as a learning scaffold in introductory programming. Rather than treating comments merely as optional documentation, the intervention framed them as an instructional device to help students make reasoning explicit, structure their solutions, improve code readability, and support debugging and reflection. The intervention was implemented during regular classroom instruction and was integrated into the normal progression of the Programming Languages course.
The instructional sequence combined direct teaching, guided practice, and independent student work, with a strong emphasis on progressively moving students from code reading to code explanation and then to code production. Across the intervention, students engaged in activities that required them not only to execute or correct code, but also to explain the purpose of specific lines or blocks of code and to use comments as a means of organizing computational reasoning. This design aligned the intervention with the study’s central assumption that comments can serve as both cognitive and metacognitive scaffolds in early programming learning.
Four structured worksheets were developed specifically for the study and used as the core instructional artifacts. These worksheets focused on complementary dimensions of novice programming performance:
  • Functional comments. Students practiced identifying and writing comments that describe the operational purpose of specific code segments or instructions.
  • Code indentation. Students worked on organizing and interpreting code structure through indentation, with particular emphasis on readability, control flow, and syntactic clarity.
  • Non-functional comments. Students explored comments that support a broader understanding of the program, such as describing logic, planning, or contextual meaning beyond line-by-line functionality.
  • Code debugging. Students analyzed and corrected flawed code, using comments and structured reasoning to identify errors and clarify intended behavior.
These worksheets were completed in class and submitted at the end of each session through the digital classroom platform. The tasks were deliberately sequenced to support a progression from reading and interpreting commented code, to completing missing comments, to producing comments for self-written code, and finally to using comments as a support for debugging and problem solving. This progression was intended to reduce cognitive overload while gradually increasing students’ responsibility for articulating the logic of their own programs.
In practical terms, each worksheet corresponded to a distinct classroom task sequence within the intervention and was treated not only as an instructional activity, but also as a source of supporting evidence regarding students’ evolving engagement with code explanation, structure, and debugging. For this reason, the worksheets are later revisited in Section 4 as qualitative classroom artifacts that help contextualize the quantitative pre-/post-intervention findings.
In pedagogical terms, the intervention emphasized the following recurring activity types:
  • Reading commented code, in which students interpreted pre-commented examples and related code blocks to algorithmic intent;
  • Completing missing comments, in which students filled in or improved incomplete explanations in partially scaffolded code;
  • Commenting on their own code, in which students were prompted to explicitly describe the purpose of instructions, conditions, or solution steps;
  • Indentation and structure-focused exercises, aimed at improving code readability and control-flow interpretation;
  • Debugging and interpretation tasks, in which students used comments to identify inconsistencies between intended and actual program behavior;
  • Teacher-guided questioning and feedback, used to prompt explanation without immediately providing the solution.
The intervention was also supported by short theoretical explanations, but these were intentionally limited to the essential concepts required for task completion. The dominant pedagogical approach was practical and student-centered: students were encouraged to solve tasks autonomously, while the teacher provided individualized support, guiding questions, and, when necessary, collective demonstrations of reasoning using projected solutions or board-based walkthroughs. This balance between autonomy and scaffolding was particularly important in a heterogeneous vocational classroom, where some students required more explicit support than others.

3.4. Digital Learning Resources and Instructional Materials

A key feature of the intervention was that it was embedded in a digitally supported instructional environment, rather than being implemented as a purely paper-based or lecture-based strategy. This is important because the pedagogical value of comment-based scaffolding in the present study depended not only on the content of the worksheets, but also on how digital tools were used to organize activities, distribute materials, collect student work, and provide feedback.
The main digital platform used throughout the intervention was Google Classroom (Google LLC, Mountain View, CA, USA), which served as the central hub for the distribution of materials, submission of worksheets, and organization of class activities. The four intervention worksheets were completed in class and submitted through Google Classroom at the end of each session, ensuring traceability of student work and facilitating the collection of learning artifacts. According to the report, all students present submitted the worksheets through this platform, which also supported continuity between sessions and access to materials outside the immediate classroom moment.
Google Forms (Google LLC, Mountain View, CA, USA) was used extensively for assessment and structured data collection. The computational thinking test was administered digitally through Google Forms and completed entirely on computers in the classroom. The platform enabled flexible delivery, standardized administration, and consistent data capture. In the broader teaching context, Google Forms was also used for theoretical and practical tests, allowing automatic correction of multiple-choice items, randomization of questions and answer options, and efficient generation of response statistics. These affordances reduced administrative overhead and supported timely feedback [22].
In addition to these platforms, the intervention drew on a wider set of digital and multimedia-supported instructional resources, including:
  • Guided worksheets, specifically designed for the intervention and focused on comments, indentation, and debugging;
  • Self-explanatory tutorials, used to support independent or semi-guided work;
  • Interactive online tasks, which provided immediate feedback and allowed students to test code and receive hints;
  • Projected walkthroughs and visual classroom support, including board-based and screen-based demonstrations of reasoning;
  • Review materials and structured practice tasks, aligned with the logic of the classroom exercises.
The broader supervised teaching practice also included Kahoot!-based review quizzes in some instructional units. However, these quizzes were part of the wider digitally enriched teaching environment and were not treated as a core analytical component of the specific comment-centered intervention examined in this article. Accordingly, Kahoot! (Kahoot ASA, Oslo, Norway) is mentioned here only to characterize the broader multimedia-supported instructional context, whereas the focal intervention analyzed in the present study was centered on the structured worksheet sequence, classroom guidance, and the associated digital submission and assessment tools.
Taken together, these tools formed a structured digital learning ecosystem in which comments were not taught in isolation, but embedded in a sequence of tasks supported by digital platforms, immediate or near-immediate feedback, and reusable instructional materials. This is particularly relevant for the positioning of the article within the context of digital and multimedia-supported learning, since it shows that the intervention combined a simple pedagogical strategy (comment use) with a coherent digitally mediated instructional design.
Importantly, the digitally supported environment was not limited to content distribution or online submission. It also incorporated multimodal instructional supports, including text-based explanations, visual demonstrations, projected walkthroughs, interactive online exercises, and feedback-oriented tasks that allowed students to test solutions and receive hints. In the broader supervised teaching context, additional digital resources such as Kahoot-based review quizzes and interactive tutorial materials further reinforced the multimedia dimension of the learning environment. For this reason, the present intervention is best understood not simply as a comment-based strategy delivered through digital tools, but as a structured multimedia-supported learning design in which comments functioned as a central pedagogical scaffold.

3.5. Data Collection Instruments

Two main instruments were used to evaluate the effects of the intervention: (i) a computational thinking (CT) test and (ii) a pre-/post-intervention questionnaire on the use of code comments. In addition, the intervention generated classroom artifacts—particularly four structured worksheets—which provided complementary qualitative evidence regarding students’ performance and evolving understanding of code comments, code structure, and debugging.

3.5.1. Computational Thinking Test

The first instrument was a computational thinking test administered before and after the intervention. The study used the CT-test 2.0, an established and previously validated multiple-choice instrument selected because it does not require prior formal programming knowledge and is therefore suitable for students at an early stage of programming learning [24,25]. According to the report, the choice of this instrument was also justified by prior evidence of content validity, criterion validity, and convergent validity reported in earlier studies by Román-González and colleagues [24,25].
The test consisted of 28 multiple-choice items, each with four answer options, of which only one was correct. Each correct answer was scored with one point, resulting in a total score ranging from 0 to 28, which was also expressed as a percentage for descriptive analysis. The instrument was administered digitally via Google Forms and completed individually on computers during class.
The 28 items were distributed across seven fundamental computational thinking concepts, with four items per concept: simple instructions and sequences (C1), repeat loops (C2), repeat-until loops (C3), simple conditionals/if (C4), compound conditionals/if-else (C5), while loops (C6), and basic functions (C7). The items were organized in increasing order of difficulty. In addition, the test items were mapped onto the four pillars of computational thinking—abstraction, decomposition, pattern recognition, and algorithmic thinking—following the mapping approach adopted in the report. This allowed the analysis to be carried out at three levels: total score, concept-level performance, and pillar-level performance.
The instrument included different item formats typical of the CT-test, such as directional navigation tasks, block-based instruction problems, and drawing tasks involving a digital “artist”, all designed to assess computational reasoning independently of prior expertise in text-based programming.

3.5.2. Questionnaire on Code Comments

The second instrument was a pre-/post-intervention questionnaire designed to examine students’ knowledge, practice, and perceptions regarding the use of code comments in programming learning. The questionnaire comprised 11 items, organized into three sections, and was administered before and after the intervention to capture changes in students’ understanding, commenting habits, and perceived pedagogical value of code comments.
The first section, Knowledge about Code Comments, included three items: one dichotomous item (“yes/no”) about familiarity with the concept of code comments and two open-ended items asking students to distinguish between inline and block comments and to define what a code comment is.
The second section, Practice of Using Code Comments, included four Likert-type items. One item measured the frequency with which students wrote comments in their own code using a 5-point scale ranging from 1 = never to 5 = always. The remaining three items assessed agreement with statements about whether code comments facilitate later code comprehension, support reflective learning, and help students think and plan while programming, each using a 5-point agreement scale ranging from 1 = strongly disagree to 5 = strongly agree.
The third section, Perceptions of Code Comments, included four open-ended items asking students what they usually write in comments, what benefits they perceive in using comments when learning programming, what difficulties they encounter when writing comments, and what suggestions they would give to make comment-writing more effective for learning.
Given its intentionally mixed-format design, the questionnaire should not be interpreted as a single homogeneous psychometric scale. Instead, it was designed as an exploratory classroom-based instrument combining descriptive and interpretive evidence. More specifically, only the four Likert-type items in the Practice section (Items 4–7) were suitable for numerical aggregation into a subsection score, whereas the dichotomous and open-ended items in the Knowledge and Perceptions sections were analyzed descriptively and/or qualitatively according to their response format [24,25,26].
Because the questionnaire was developed specifically for this classroom intervention and combined heterogeneous response formats (dichotomous, Likert-type, and open-ended items), it should be understood as a researcher-developed exploratory instrument rather than as a psychometrically validated scale. Accordingly, its role in this study was primarily descriptive and interpretive, with numerical aggregation restricted to the four Likert-type items in the Practice subsection [24,25,26].

3.5.3. Classroom Artifacts and Qualitative Evidence

Beyond the two formal instruments, the study also generated classroom-produced artifacts, particularly the four structured worksheets developed for the intervention: functional comments, code indentation, non-functional comments, and code debugging. These worksheets were completed in class and submitted at the end of each session, providing evidence of how students engaged with the targeted pedagogical tasks throughout the intervention.
These materials served a dual role. First, they were the main pedagogical tools used to scaffold learning during the intervention. Second, they provided complementary qualitative evidence regarding students’ progress in commenting practices, structural organization of code, and debugging strategies. In the original report, worksheet performance was examined comparatively, including differences between students with higher and lower average academic performance in the course. For the purposes of the present article, however, these artifacts are best used as supporting qualitative evidence to contextualize and interpret the main quantitative findings rather than as the basis for a separate full qualitative analysis.

3.6. Data Analysis Procedures

The data analysis combined descriptive, comparative, and supportive qualitative procedures appropriate to the exploratory nature of the study, the small sample size (n = 10), and the mixed-format structure of the data collection instruments. Because the study integrated quantitative test scores, mixed-format questionnaire responses, and classroom-generated learning artifacts, the analysis was conducted separately for each data type and then interpreted in an integrated manner.

3.6.1. Analysis of the Computational Thinking Test

For the computational thinking (CT) test, the main analytical objective was to compare students’ performance before and after the intervention. The primary outcome variable was the total CT-test score (0–28), which was analyzed both in raw score and percentage terms. Descriptive statistics included mean, standard deviation, and percentage gain between the pre-test and post-test. Given the small sample size and the repeated-measures structure of the design, the main inferential comparison for the final manuscript was conducted using the Wilcoxon signed-rank test, which is appropriate for paired non-parametric data. In addition, an effect size is reported (preferably rank-biserial correlation or r) to indicate the magnitude of the observed change.
Beyond the total score, the CT-test results were also examined at two complementary descriptive levels: (i) performance by computational thinking concept (seven concepts, four items each) and (ii) performance by computational thinking pillar (abstraction, decomposition, pattern recognition, and algorithmic thinking), following the mapping adopted in the original report. Because of the limited sample size, these concept- and pillar-level analyses are best treated as descriptive exploratory analyses intended to characterize learning patterns rather than as the basis for multiple separate inferential tests.

3.6.2. Analysis of the Questionnaire on Code Comments

The questionnaire on code comments contained heterogeneous item formats and was therefore analyzed according to the nature of each response type rather than as a single unified scale. In line with the structure of the instrument, the analysis was organized into three domains: knowledge, practice, and perceptions.
In the Knowledge section, the dichotomous item on familiarity with code comments was analyzed descriptively using absolute and relative frequencies. The two open-ended items were analyzed through categorical qualitative coding, with student responses grouped into analytical categories reflecting the degree of conceptual precision, technical correctness, and explanatory completeness. The distribution of these categories was then compared between the pre- and post-intervention moments.
In the Practice section, the four Likert-type items (Items 4–7) were analyzed using frequency distributions, percentages, and descriptive indicators of central tendency (particularly mean values for item-level comparison). Because these four items addressed closely related aspects of commenting practice, they were also treated as an exploratory subsection score for descriptive comparison between the pre- and post-intervention moments. Given the small sample size (n = 10) and the repeated-measures design, a Wilcoxon signed-rank test was used as an exploratory inferential check for the aggregated practice subsection score, with effect size reported cautiously and interpreted as supportive rather than definitive evidence.
In the Perceptions section, the four open-ended items were analyzed through categorical qualitative coding. Responses were grouped into recurring thematic categories (e.g., type of content written in comments, perceived benefits, reported difficulties, and suggested improvements), and the frequency of these categories was compared before and after the intervention. Selected excerpts from student responses were used to illustrate salient shifts in understanding and attitudes where appropriate.
The qualitative categorization of open-ended questionnaire responses and worksheet-derived observations was initially conducted by the first author through iterative reading and grouping of recurrent response patterns. The resulting category structure and interpretive summaries were then reviewed and discussed with the second author to ensure conceptual consistency and alignment with the study’s analytical framework. Given the exploratory nature of the study and the small corpus of responses, this process is presented as researcher-guided interpretive coding rather than as a formal inter-rater reliability procedure.
Overall, the questionnaire results are therefore interpreted primarily as descriptive and exploratory evidence, complemented by limited inferential analysis only for the small Likert-based practice subsection. This analytical strategy is more appropriate than treating the full questionnaire as a psychometrically validated scale, given its mixed-format classroom-based design and the exploratory nature of the study.

3.6.3. Analysis of Classroom Artifacts and Qualitative Triangulation

The four structured worksheets produced during the intervention were used as supporting qualitative evidence rather than as the basis for a separate full qualitative study. Their primary role in the present article is to provide triangulation for the main quantitative findings by illustrating how students engaged with comment-writing, code organization, indentation, and debugging tasks throughout the intervention. In particular, these materials may be used to support the interpretation of improvements observed in the CT-test and questionnaire by showing how students progressively used comments as tools for explanation, planning, and error detection.
Accordingly, the classroom artifacts were examined interpretively, with attention to recurring patterns in student performance and task completion, including differences previously identified in the original report between students with higher and lower average academic performance. For the purposes of this article, however, such evidence is used only in a supportive and contextualizing role, ensuring that the paper remains focused on the central pre-/post-intervention findings.

3.6.4. Integrated Interpretation

Finally, the findings from the three sources of evidence—CT-test results, questionnaire responses, and classroom artifacts—were interpreted in an integrated manner. This triangulated reading of the data was used to examine not only whether students’ computational thinking performance improved after the intervention, but also how their knowledge, practices, and perceptions regarding code comments evolved, and whether these changes were consistent with observed classroom engagement during the intervention. This integrated analytical strategy is consistent with the exploratory mixed-methods design of the study and supports a more nuanced interpretation of the pedagogical value of code comments in introductory programming.

4. Results

4.1. Computational Thinking Test Results

The pre- and post-intervention results of the Computational Thinking (CT) test indicate a substantial improvement in students’ performance after the pedagogical intervention based on the systematic use of code comments. To examine this change at the level of the primary outcome, students’ total CT-test scores (maximum = 28) were compared between the pre-test and post-test administrations. The overall mean score increased from 12.0 (42.9% of the maximum score; SD = 3.23) in the pre-test to 25.4 (90.7%; SD = 1.90) in the post-test, corresponding to an average gain of 13.4 points. The median increased from 12.5 to 26.0, and the minimum score rose from 8 to 22, indicating that the improvement was observed across the full group.
Given the small sample size and the paired nature of the data, a Wilcoxon signed-rank test was used to compare pre- and post-intervention CT-test scores. The results indicated a statistically significant increase after the intervention (W = 55.0, p < 0.01), with a rank-biserial correlation of 1.00, indicating an extremely large effect size. Importantly, all ten students improved their total CT-test scores. Although the rank-biserial correlation reached 1.00, this value should be interpreted cautiously in light of the very small sample size and the uniform direction of improvement across participants. In this context, the effect size indicates a consistently strong pre–post gain, but it should not be interpreted as evidence of perfect or intervention-only causal effectiveness.
At the overall level, the average percentage of correct answers increased from 43% in the pre-test to 91% in the post-test, corresponding to a gain of 48 percentage points. This result suggests a marked enhancement in students’ computational thinking performance following the intervention.
To obtain a more fine-grained view of this progression, the CT test results were also analyzed by computational concept. As shown in Table 1, all seven assessed concepts improved from pre-test to post-test. The highest pre-test scores were observed in the more introductory concepts, such as simple instructions and sequences (C1, 83%) and repetition structures using repeat (C2, 85%), both of which reached ceiling-level performance (100%) in the post-test. However, the most substantial gains were observed in concepts that typically impose greater cognitive demands on novice learners, namely simple conditionals (if, C4: 20% to 95%), compound conditionals (if-else, C5: 20% to 93%), while loops (C6: 15% to 68%), and basic functions (C7: 13% to 80%).
These results are particularly relevant because they suggest that the intervention did not merely reinforce already familiar content, but also supported students in developing competence in more complex programming structures that require greater abstraction, control-flow understanding, and procedural reasoning.
A complementary analysis was performed according to the four core pillars of computational thinking: abstraction, decomposition, pattern recognition, and algorithmic thinking. As shown in Table 2, all four pillars exhibited substantial gains between the pre- and post-test. Mean performance increased from 39% to 89% in abstraction, from 39% to 89% in decomposition, from 38% to 90% in pattern recognition, and from 43% to 91% in algorithmic thinking. The gains were therefore both strong and relatively balanced across the four dimensions, indicating that the intervention supported a broad-based development of computational thinking rather than isolated improvement in a single skill domain.
In addition to the increase in mean performance, a consistent reduction in score dispersion was observed across all four pillars. Standard deviations decreased from 0.36 to 0.15 for abstraction, from 0.33 to 0.15 for decomposition, from 0.34 to 0.14 for pattern recognition, and from 0.35 to 0.14 for algorithmic thinking. This reduction suggests that students not only improved on average, but also became more homogeneous in their performance, indicating that the intervention may have contributed to reducing differences between initially stronger and weaker students.
Overall, the CT test results provide convergent evidence that the proposed instructional strategy was associated with meaningful gains in computational thinking, both in terms of overall performance and in the development of specific conceptual and cognitive dimensions.
To complement the concept- and pillar-level analyses, Table 1 presents the descriptive statistics for the pre- and post-intervention total scores in the Computational Thinking (CT) test.
To provide a more detailed analysis of students’ progress in the Computational Thinking (CT) test, Table 2 presents the pre- and post-intervention results for each of the seven programming concepts assessed. As shown in Table 2, all seven programming concepts improved from pre-test to post-test, with the largest gains observed in conditionals, while loops, and basic functions.
To visually illustrate the magnitude of these concept-level gains, Figure 1 compares pre- and post-test performance across the seven programming concepts. Figure 1 clearly shows that the most pronounced improvements occurred in the concepts that were initially more challenging for students, particularly those involving conditional logic and procedural abstraction.
In addition to the analysis by programming concept, Table 3 summarizes students’ performance according to the four core pillars of computational thinking: abstraction, decomposition, pattern recognition, and algorithmic thinking. Table 3 shows that all four computational thinking pillars improved substantially, with gains ranging from 0.48 to 0.52 and a consistent reduction in variance and standard deviation in the post-test.
To facilitate comparison across the four computational thinking pillars, Figure 2 provides a visual representation of the pre- and post-test mean scores for each dimension. As illustrated in Figure 2, the intervention produced strong and balanced gains across all four pillars, suggesting a broad-based development of computational thinking rather than isolated improvement in a single domain.
Overall, the CT test results suggest that the proposed instructional strategy was associated with meaningful gains in computational thinking, both in terms of overall performance and in the development of specific conceptual and cognitive dimensions.

4.2. Questionnaire Results on Code Comments

To complement the computational thinking test results, students also completed a pre- and post-intervention questionnaire designed to examine their knowledge, practice, and perceptions regarding the pedagogical use of code comments in programming. In line with the mixed-format structure of the instrument, the questionnaire results are presented by domain rather than as a single total score. This approach is methodologically more appropriate because the instrument combined one dichotomous item, four Likert-type items, and six open-ended items.
For clarity, Table 4 summarizes the full structure of the questionnaire, identifies which items belong to each domain, and indicates the corresponding analytical treatment adopted in this study.
The worksheet-based evidence presented in this section should be interpreted as complementary qualitative support for the observed learning progression rather than as an isolated measure of the effectiveness of the worksheets themselves. Because the intervention combined guided worksheets with teacher mediation, digital resources, and formative feedback, the patterns identified here are best understood as part of the broader instructional design.

4.2.1. Knowledge About Code Comments

The first domain examined students’ conceptual understanding of code comments. In the dichotomous familiarity item, all students (10/10) reported that they were familiar with the concept of code comments both before and after the intervention. However, the open-ended responses revealed that this initial self-reported familiarity did not correspond to a fully developed or operational understanding.
Before the intervention, most students were unable to clearly distinguish between inline comments and block comments. In the broader report, nine students (90%) explicitly indicated that they did not know the difference, while one student did not provide an answer. After the intervention, all ten students (100%) were able to provide a correct distinction between the two forms. This shift was also visible in the content of the responses. For example, one post-intervention student explanation explicitly stated that “inline comments are made with a # and comment only one line, whereas block comments can extend across multiple lines and are used for more detailed explanations,” indicating not only syntactic recognition but also an emerging awareness of functional purpose. A similar pattern emerged in the item asking students to define what a code comment is. Before the intervention, responses were often superficial, incomplete, or focused only on the technical syntax of writing comments. After the intervention, most students provided more complete and pedagogically meaningful definitions, explicitly linking comments to explanation, documentation, organization of reasoning, or support for later code understanding. A representative post-intervention response, for instance, described a code comment not merely as a syntactic marker but as text used to explain what the code is doing and to help the programmer remain oriented while reading or revising it later.
Taken together, these results suggest that the intervention did not simply reinforce superficial familiarity with the idea of comments, but contributed to a more structured and functionally relevant conceptual understanding of what code comments are and how they can be used in programming practice.

4.2.2. Practice of Using Code Comments

The second domain examined students’ commenting practices through the four Likert-type items (Items 4–7), which focused on the frequency of comment writing and on students’ views regarding the role of comments in later code comprehension, reflective learning, and planning while programming. Across all four items, a clear positive shift was observed between the pre- and post-intervention administrations.
For the item on frequency of writing comments, the pre-intervention pattern indicated limited habitual use: six students (60%) reported writing comments rarely, three students (30%) reported doing so sometimes, and one student (10%) reported never doing so. After the intervention, this pattern reversed markedly: six students (60%) reported writing comments always, and four students (40%) reported doing so frequently.
For the item assessing whether comments facilitate later code comprehension, all ten students (100%) selected the neutral option before the intervention, suggesting a lack of established opinion or practical experience. After the intervention, all responses became positive, with five students (50%) selecting agree and five students (50%) selecting strongly agree.
A similarly consistent pattern was found for the item examining whether writing comments supports reflective learning. Before the intervention, eight students (80%) selected the neutral option and two students (20%) selected disagree. After the intervention, all responses shifted to the positive range, with five students (50%) selecting agree and five students (50%) selecting strongly agree.
Finally, for the item asking whether comments help students think and plan while programming, the pre-intervention responses were more dispersed and less favorable: six students (60%) selected the neutral option, two students (20%) selected disagree, one student (10%) selected strongly disagree, and one student (10%) selected agree. After the intervention, all students responded positively, with five students (50%) selecting agree and five students (50%) selecting strongly agree.
Globally, the Practice domain reveals a clear and consistent progression from sporadic or superficially expressed commenting behaviors toward a more systematic, purposeful, and pedagogically valuable use of code comments. These findings indicate that students increasingly perceived commenting not as a secondary or optional activity, but as an important mechanism for supporting code understanding, reflective learning, and structured reasoning throughout the problem-solving process.
To summarize the quantitative progression in the Practice domain, Table 5 reports the mean pre- and post-intervention scores for the four Likert-type items (Items 4–7), showing consistent improvement across all items.
For a visual comparison of the magnitude and consistency of these changes across the Practice subsection, Figure 3 presents the mean pre- and post-intervention scores for Items 4–7.
Overall, the Practice domain shows a coherent and substantial shift from infrequent or weakly articulated commenting habits toward a more regular, intentional, and pedagogically meaningful use of code comments. These results suggest that students increasingly came to view commenting not merely as an optional add-on, but as a useful support for code comprehension, reflective learning, and planning during problem solving.

4.2.3. Perceptions of Code Comments

The third domain examined students’ open-ended perceptions regarding what they write in comments, the benefits they associate with comments, the difficulties they encounter, and their suggestions for improving this practice in programming learning. Across these items, the qualitative responses showed a clear shift from sparse, vague, or usage-absent answers before the intervention to more detailed, diverse, and pedagogically grounded reflections afterward.
In the item asking what students usually write in their code comments, the pre-intervention responses suggested limited or superficial use. In the broader report, five students (50%) stated that they did not usually use comments, three students (30%) referred mainly to brief annotations, and two students (20%) mentioned using comments only to identify the exercise. After the intervention, all students provided richer descriptions, referring to explanations of code behavior, summaries of functions, personal notes, descriptions of inputs and outputs, or observations about possible improvements. This qualitative broadening can be illustrated by the contrast between minimal pre-intervention responses such as using comments only to identify the exercise and richer post-intervention descriptions referring to explanations of code behavior, summaries of functions, personal notes about decisions taken, and observations about possible future improvements.
In the item on the benefits of comments when learning something new in programming, most students initially struggled to identify clear advantages. In the broader report, six students (60%) indicated that they did not know or did not use comments enough to identify benefits. After the intervention, all students reported concrete and varied benefits, including support for problem solving, easier later review of code, improved conceptual understanding, error identification, and better organization of reasoning. The change is also reflected in the contrast between pre-intervention statements indicating absence of use or perceived benefit (e.g., “I do not see any benefit because I do not use comments”) and post-intervention responses describing comments as helpful for solving problems, revising code, identifying errors, organizing thought, and supporting learning.
In the item on difficulties encountered when writing comments, the pre-intervention responses often reflected a lack of experience rather than articulated obstacles. After the intervention, students were better able to identify authentic challenges, including the lack of time, uncertainty about what level of detail to include, and occasional perceptions that comments may not always seem necessary. Importantly, this post-intervention shift from “not using comments” toward identifying practical constraints suggests a more mature engagement with the practice: students were no longer merely unfamiliar with commenting, but were beginning to reflect on how to use it effectively and when it becomes genuinely useful. This shift is analytically meaningful because it suggests that students had moved from not engaging sufficiently with the practice to reflecting critically on its real constraints.
In the final item on suggestions for improving the practice of commenting, pre-intervention responses were mostly absent or minimal. After the intervention, students proposed more specific pedagogical suggestions, such as more practical sessions, continued practice over time, and more teacher feedback on the quality and usefulness of comments.
Overall, the Perceptions domain indicates that the intervention was associated not only with more frequent use of comments, but also with a qualitative broadening of students’ understanding of what comments can do in programming learning. Students increasingly described comments as tools for explanation, organization, review, reflection, and communication rather than as merely decorative or optional textual additions.
Taken together, the questionnaire findings should be interpreted as exploratory and context-specific, but they consistently reinforce the main interpretation of the study: within this small vocational secondary classroom, the intervention was associated with clearer conceptual understanding, more intentional commenting practices, and richer pedagogical perceptions regarding the role of code comments in introductory programming.
To complement the questionnaire-based qualitative findings, the classroom-produced worksheets also provided supportive evidence of progressive change across the intervention. Considered in sequence, the four worksheets suggest a pedagogically coherent trajectory from basic recognition and reproduction of commenting conventions toward more purposeful and reflective use of comments in authentic programming tasks. In the earlier worksheets, students mainly demonstrated emerging awareness of functional comments and code organization, often requiring closer instructional support to identify the purpose of code segments and to align comments with program structure. In the intermediate activities, student work increasingly showed more consistent indentation, clearer differentiation between functional and non-functional comments, and more deliberate attempts to connect comments with code meaning rather than merely reproducing surface descriptions. In the final debugging-oriented worksheet, several students appeared to use comments not only to annotate code, but also to support reasoning about errors, explain intended logic, and document corrective decisions. Although these classroom artifacts are interpreted here as supporting qualitative evidence rather than as a separate formal dataset, they reinforce the overall pre-/post-intervention pattern observed in both the computational thinking test and the questionnaire results.
Taken together, these questionnaire-based findings should be interpreted as descriptive and exploratory indicators of change in students’ knowledge, practices, and perceptions regarding code comments, rather than as psychometrically validated measurements of stable constructs.

4.3. Synthesis of Findings

Taken together, the quantitative results reveal a coherent and convergent pattern. On the one hand, students demonstrated a marked improvement in computational thinking performance, with the overall CT test average increasing from 43% to 91%. This improvement was observed across all seven programming concepts and all four computational thinking pillars, with especially pronounced gains in conditionals, while loops, and basic functions. On the other hand, students also showed a substantial and statistically significant increase in their questionnaire scores regarding the perceived usefulness and use of code comments, with mean scores rising from 46.6% to 89.4% of the maximum possible score.
The convergence between these two sources of evidence is pedagogically meaningful. The CT test results suggest that students improved in problem decomposition, abstraction, pattern recognition, and algorithmic reasoning, while the questionnaire results indicate that they increasingly perceived code comments as tools for planning, organizing thought, and making reasoning explicit. This alignment supports the interpretation that code comments may have functioned not merely as a formatting or documentation aid, but as a form of cognitive scaffolding that helped students externalize reasoning and structure problem-solving processes.
Although the exploratory nature of the study and the small sample size require caution in generalization, the consistency of the gains across multiple indicators suggests that the intervention was associated with a meaningful enhancement in both programming-related cognition and students’ metacognitive engagement with code.

5. Discussion

5.1. Code Comments as Cognitive and Metacognitive Scaffolds

The results of this exploratory classroom study suggest that the pedagogical use of code comments may have played a meaningful role in supporting students’ learning in introductory programming. The observed gains were not limited to students’ general performance on the Computational Thinking (CT) test; rather, they were visible across all assessed programming concepts and all four CT pillars, while also being accompanied by substantial changes in students’ perceptions of the role of comments in programming. Taken together, these findings support the interpretation that code comments functioned as both cognitive and metacognitive scaffolds during the intervention.
It is also important to distinguish between the focal pedagogical role of the comment-centered worksheets and the broader digitally supported instructional environment in which they were embedded. While the worksheets constituted the most direct and intentionally designed scaffold for practicing code commenting, the observed gains cannot be attributed to these materials in isolation. Rather, they should be interpreted as emerging from the combined influence of the worksheets, teacher mediation, iterative feedback, repeated classroom practice, and the surrounding digital learning resources.
From a cognitive perspective, code comments appear to have helped students make explicit the logic of a solution before, during, and after coding. In novice programming contexts, one of the main challenges is that learners must simultaneously manage syntax, logic, sequencing, and problem decomposition, often without yet having stable internal representations of these processes. This is consistent with prior literature showing that introductory programming is difficult not only because of syntax, but because students often struggle with conceptual and strategic knowledge, problem interpretation, and the translation of intentions into executable structures [2,24]. By requiring students to read commented code, complete missing comments, and annotate their own solutions, the intervention likely reduced part of this cognitive burden by externalizing intermediate reasoning steps. In this sense, comments may have operated as a form of structured support for identifying goals, segmenting actions, and linking code fragments to intended functionality.
This interpretation is also consistent with generative learning theory. As argued by Fiorella and Mayer [8], learning is strengthened when students actively generate meaning by organizing, explaining, and transforming information rather than passively receiving it. In the present study, comments were not treated merely as documentation conventions, but as prompts for students to verbalize and structure their reasoning. This use is closely aligned with self-explanation, one of the most robust generative learning strategies described in the literature [8]. In practical terms, asking students to explain code in comments may have helped them convert implicit procedural actions into explicit cognitive representations.
The concept-level CT test results reinforce this interpretation. Although students already showed relatively high pre-test performance in simpler concepts such as instructions and basic repetition structures, the largest gains were observed in concepts that are typically more demanding for novice learners, including simple conditionals, compound conditionals, while loops, and basic functions. These structures often require learners to coordinate branching logic, repeated evaluation of conditions, or the abstraction of reusable procedures. The fact that the strongest improvements occurred precisely in these areas suggests that comments may have supported students in organizing the procedural and logical structure of solutions more effectively, rather than merely improving surface-level familiarity with syntax. This interpretation is coherent with research showing that novice programmers frequently struggle with problem decomposition, control flow, and code composition, particularly when they lack explicit support for structuring their reasoning [1,24].
From a metacognitive perspective, the questionnaire results are especially revealing. Students’ questionnaire scores increased markedly from pre- to post-intervention, and all seven items improved. The strongest gains were found in items associated with more reflective and explanatory uses of comments, particularly those related to organizing reasoning, clarifying the purpose of code, and making solutions easier to understand. This suggests that students increasingly came to see comments not simply as an optional documentation feature, but as a strategy for planning, checking, and explaining their own thinking. In other words, comments appear to have supported not only what students wrote, but also how they monitored and regulated their programming process.
This interpretation is supported by prior work on metacognition in programming. Loksa et al. [10] argue that novice programmers often lack awareness of the stages of programming problem solving and benefit from explicit prompts that make those stages more visible. Similarly, Prather et al. [25] showed that novice programmers frequently face metacognitive difficulties in programming environments, particularly when tools or tasks do not explicitly support reflection on their problem-solving process. More recent work has continued to emphasize the importance of self-regulated learning and metacognitive scaffolding in programming education, especially in relation to debugging, monitoring progress, and responding to feedback [26,27]. Within this broader perspective, pedagogically structured comments can be interpreted as a lightweight but effective metacognitive prompt embedded directly into code-writing activity.
A particularly noteworthy aspect of the results is that the intervention was associated not only with improved mean performance, but also with reduced dispersion across the four CT pillars. This suggests that the strategy may have been especially helpful for students who initially had weaker performance, contributing to a more homogeneous learning outcome across the class. In educational terms, this is important because scaffolding strategies are especially valuable when they support learners who might otherwise struggle to structure their reasoning independently. This aligns with broader educational arguments that explicit, low-threshold scaffolds can improve access to complex reasoning tasks by making hidden cognitive steps more visible and actionable [8,28].
From a theoretical perspective, these findings are broadly consistent with research suggesting that novice learners benefit when instructional designs make reasoning processes more explicit and externally representable. In this study, code comments appear to have functioned less as a conventional software engineering convention and more as a pedagogical device for structuring attention, prompting explanation, and encouraging reflection during problem solving. At the same time, because the present design does not isolate comments from all other features of the instructional sequence, the results should be interpreted as supporting the pedagogical plausibility of comment-based scaffolding in this context rather than as establishing a narrowly isolated causal effect.
Overall, the findings support the view that code comments can be more than a software engineering convention or a readability aid. In introductory programming education, especially with novice learners, they may serve as a pedagogically meaningful mechanism for making problem-solving processes visible, structured, and discussable. Although the literature on code comments in novice education is still relatively limited, recent work has begun to explore students’ commenting practices and their relationship to learning and academic success, suggesting that comments deserve more explicit attention in computing education research [14,29].

5.2. Implications for Digital Learning in Introductory Programming

Beyond the specific focus on code comments, the present study has broader implications for digital learning in introductory programming, which is particularly relevant to the scope of Digital. One of the main contributions of this work is that it shows how a relatively simple pedagogical strategy—structured use of comments in code—can become significantly more powerful when embedded within a digital learning ecosystem that combines guided tasks, online forms, classroom platforms, and iterative feedback.
In this study, the intervention did not rely solely on students writing comments in isolation. Rather, it was implemented through a set of digitally mediated instructional resources, including Google Classroom, Google Forms, structured worksheets, guided coding exercises, and feedback-oriented activities. This broader environment matters. The educational value of comments was likely amplified by the fact that students interacted with them across multiple formats: reading commented examples, completing partial annotations, producing their own comments, and responding to digitally administered pre- and post-intervention instruments. In this sense, the study is not only about a programming micro-skill, but about how that micro-skill can be orchestrated within a digitally supported learning sequence.
This interpretation is consistent with recent literature showing that novice programming benefits from digital environments that provide structured support, formative feedback, and multiple opportunities for interaction and revision. For example, Thangaraj et al. [30], in a systematic review of formative assessment in programming education, highlight the importance of feedback-oriented designs for supporting student learning in programming contexts. Similarly, Alasmari et al. [31] argue that many online coding tutorial systems still fail to address core novice difficulties, especially those related to problem understanding and structured reasoning, despite offering practice opportunities and digital access. In this context, the present study contributes by showing that a simple instructional practice—commenting—can be used as an accessible form of digital scaffolding when intentionally embedded in an organized learning sequence.
Another important implication is that this study highlights the pedagogical potential of low-cost, digitally mediated micro-scaffolds. Much of the literature on digital learning in programming focuses on larger-scale interventions such as intelligent tutoring systems, visual programming environments, automated assessment platforms, or, more recently, AI-based assistants. These approaches are important and often powerful, but they can also be resource-intensive, institutionally uneven, or difficult to integrate into everyday school practice. By contrast, the present study suggests that meaningful gains may also be achieved through more modest interventions that leverage ordinary digital tools and target the structure of students’ reasoning directly. In that sense, the contribution is not that comments replace richer digital resources, but that they can complement them as a strategically embedded, cognitively meaningful support.
For the readership of Digital, this is a relevant point: the study demonstrates that digital transformation in education does not always require complex technologies. Sometimes, the most educationally effective innovations arise from how familiar tools are combined with pedagogically intentional design. In this case, the key innovation lies not in the novelty of the platform itself, but in the integration of a programming practice (commenting) with structured digital mediation and feedback. This perspective is consistent with broader recent work emphasizing that successful digital learning interventions in computational thinking and programming depend not only on the tool itself, but on the pedagogical orchestration surrounding its use [28,32].
The results also support a more general argument: in introductory programming, students benefit from learning environments that make the invisible processes of reasoning more visible. Digital platforms can help operationalize this by enabling structured prompts, iterative submissions, reflective questionnaires, and reusable exemplars. When code comments are positioned within such an environment, they become part of a broader ecosystem of digital scaffolding, rather than an isolated technical habit. This is especially important at a time when the field is also grappling with the implications of increasingly powerful AI tools, which may accelerate coding but can also reinforce superficial understanding if not accompanied by reflective and metacognitive supports [25,33].
For these reasons, the present study contributes to discussions on multimedia-based and digitally supported learning not only by examining a concrete classroom intervention, but also by showing how simple instructional practices can be meaningfully embedded in accessible digital ecologies to support novice learners in programming.

5.3. Relevance for Vocational Secondary Education

A further contribution of this study lies in its focus on vocational secondary education, a context that remains comparatively underrepresented in the literature on programming pedagogy and computational thinking. Much of the existing research in introductory programming and CT development has been conducted in primary education, general secondary education, higher education, or extracurricular coding contexts. By contrast, vocationally oriented upper-secondary settings often receive less attention, despite the fact that they present distinctive pedagogical conditions and educational needs. This asymmetry has been noted more broadly in recent reviews, which show that research on programming and computational thinking is abundant in K–12 and higher education, but often unevenly distributed across specific educational tracks and contexts [28,32].
This context matters for several reasons. Students in vocational secondary education frequently encounter programming as part of a broader technical or professional curriculum rather than as an abstract academic subject. As a result, they may bring different motivational profiles, prior experiences, and expectations to the classroom. In many cases, they may also benefit particularly strongly from concrete, structured, and practice-oriented instructional strategies that help bridge conceptual understanding and executable tasks. The present study suggests that the pedagogical use of code comments may be well suited to this profile, precisely because it supports reasoning in a visible, stepwise, and operationally meaningful way.
The observed gains in both CT performance and students’ perceptions of comments are especially relevant in this context. The strong improvements in more complex concepts such as conditionals, loops, and functions indicate that students were not only learning to reproduce simple code patterns, but were developing a more structured understanding of program logic. This is important in vocational pathways, where programming competence often needs to be actionable, transferable, and sufficiently robust to support future technical learning or workplace-related tasks.
Moreover, the reduction in performance dispersion across the CT pillars may be particularly significant in vocational classrooms, which often include students with heterogeneous academic trajectories and uneven prior preparation. A strategy that helps reduce performance gaps while simultaneously improving average achievement is pedagogically valuable in such settings. The results therefore suggest that code-comment-based scaffolding may be especially promising for inclusive and differentiated teaching in vocational education.
This context also strengthens the practical relevance of the study. Because the intervention relied on widely available tools and did not require specialized infrastructure, it is more likely to be feasible in schools with limited resources or with standard digital platforms already in place. This enhances the transferability of the approach to other vocational and secondary-level settings. In that respect, the study aligns with current calls for scalable, context-sensitive, and pedagogically grounded approaches to computational thinking instruction in formal education, rather than relying exclusively on high-tech or highly specialized environments [28,34].
For these reasons, this study contributes not only to the programming education literature, but also to the emerging discussion on how computational thinking and introductory programming can be taught more effectively in vocationally oriented educational pathways. In this respect, its contribution is both empirical and practical.

5.4. Limitations

Despite the encouraging results, the findings of this study should be interpreted with appropriate caution. First, the study involved a small sample size (n = 10), which limits the statistical power of the analyses and reduces the extent to which the results can be generalized to broader populations. Although the gains observed were substantial and consistent, they should be understood primarily as evidence from an exploratory classroom intervention rather than as definitive proof of causal effectiveness.
Second, the study used a single-group pre-/post-intervention design without a control or comparison group. As a result, it is not possible to attribute the observed improvements exclusively to the use of code comments. Other elements of the intervention—such as repeated exposure to programming concepts, teacher guidance, structured worksheets, digital feedback, increased familiarity with the tasks, or general maturation over the study period—may also have contributed to the gains. The role of comments is therefore best interpreted as a plausible and pedagogically meaningful contributing factor within a broader instructional design, rather than as an isolated causal variable. This caution is consistent with recommendations in computing education research, where complex classroom interventions often involve multiple interacting supports that are difficult to disentangle experimentally [24,30].
Although the rank-based effect size associated with the pre–post comparison was very large, this value should be interpreted with caution. In a very small repeated-measures sample (n = 10), effect-size estimates can become unstable and may appear inflated when improvement is highly consistent across participants. Accordingly, the observed effect should be understood as evidence of a strong within-group shift in this specific cohort rather than as a precise estimate of intervention magnitude in a broader population.
Third, the intervention took place in a specific educational context, namely a vocational secondary education classroom with a relatively small and contextually bounded cohort. This contextual specificity is valuable, but it also limits external validity. The same strategy may not produce identical results in other settings, such as general secondary education, higher education, or more diverse cohorts with different prior programming experience.
A further limitation concerns the nature of the data collected. While the study includes both performance-based and perception-based measures, and thus benefits from methodological triangulation, the CT test analysis currently relies primarily on aggregated descriptive results at the concept and pillar levels. Although these results are highly informative, future studies would benefit from larger samples and more robust inferential analyses at the individual level. Similarly, while the questionnaire results support the interpretation that students’ views of code comments changed substantially, self-report data should always be interpreted with caution, as they may reflect perceived usefulness rather than actual independent use in future tasks.
Finally, the intervention combined several pedagogical elements in an integrated way, including commented examples, guided exercises, structured worksheets, and digital tools. This is a strength from a classroom-design perspective, but it also makes it difficult to disentangle which specific component had the strongest influence. Future research could therefore compare different variants of the intervention—for example, comment-focused instruction with and without structured digital feedback, or comment-based scaffolding versus alternative reflective supports such as pseudocode or verbal self-explanation prompts.
Although the worksheet artifacts were not subjected to a full, standalone qualitative analysis in this article, they consistently showed a progression from more superficial or incomplete commenting practices toward more functional, structured, and task-relevant use of comments, thereby providing supportive contextual evidence consistent with the pre–post quantitative findings.
Taken together, these limitations do not undermine the value of the present findings, but they do suggest that the study should be understood as an exploratory and contextually situated contribution. Its main strength lies in opening a promising line of inquiry and offering a practical, theoretically grounded intervention that can be tested more rigorously in future work.
Although the present design does not allow strong causal claims, the observed pattern of pre-/post-improvement suggests that the structured pedagogical use of code comments may have supported students’ computational thinking development and reflective engagement with programming tasks.

6. Conclusions

This study examined the pedagogical potential of code comments as a structured instructional strategy in introductory programming within a vocational secondary education context. Using a mixed-methods, single-group pre-/post-intervention design, the study explored whether integrating comment-based activities into a digitally supported teaching sequence could contribute to students’ computational thinking development and to more positive perceptions of comments as learning tools.
Overall, the findings provide a positive answer to the study’s central research questions. First, the results suggest that the pedagogical use of code comments was associated with meaningful improvements in students’ computational thinking performance. Substantial gains were observed in the overall pre-/post-test comparison, across all assessed programming concepts, and across the four computational thinking pillars—abstraction, decomposition, pattern recognition, and algorithmic thinking. Particularly strong improvements were found in concepts that are often more demanding for novice learners, such as conditionals, repetition structures with more complex control logic, and basic functions.
Second, the study indicates that students’ perceptions of code comments also changed considerably over the course of the intervention. After the pedagogical sequence, students reported greater recognition of comments as useful tools for organizing ideas, clarifying reasoning, understanding code, and supporting problem solving. These changes reinforce the interpretation that comments can function not only as technical annotations, but also as pedagogically meaningful cognitive and metacognitive supports in early programming learning.
The principal contribution of this study lies in demonstrating that code comments can be repositioned in programming education from a secondary software engineering convention to an explicit instructional scaffold. In this sense, the study contributes to the growing body of research that seeks to make novice learners’ reasoning more visible and more supportable during coding activities. It also offers a practical contribution by showing that this can be achieved through a low-cost and easily transferable pedagogical design, without requiring specialized infrastructure or complex educational technologies.
A second major contribution is the study’s relevance to digitally supported learning. Rather than treating code comments as an isolated classroom practice, the intervention embedded them within a broader digital learning ecosystem that included Google Classroom, Google Forms, structured worksheets, guided exercises, and feedback-oriented activities. This demonstrates that effective digital innovation in programming education does not necessarily depend on sophisticated tools alone; it can also emerge from the pedagogically intentional use of accessible digital platforms combined with well-designed micro-scaffolds that directly support reasoning and reflection.
From a pedagogical perspective, the findings suggest that teachers of introductory programming—especially in secondary and vocational settings—may benefit from integrating code comments more deliberately into instruction. Rather than presenting comments only as optional documentation or stylistic good practice, educators may use them as a means to help students plan solutions, externalize logic, interpret code structure, and monitor their own understanding. Activities such as reading commented examples, completing missing comments, annotating partially correct solutions, and commenting on one’s own code appear particularly promising for novice learners.
At the same time, the results should be interpreted in light of the study’s limitations. The small sample size, the absence of a control group, and the context-specific nature of the intervention mean that the findings should be understood as exploratory rather than broadly generalizable. The positive outcomes likely reflect the combined effect of several elements within the intervention, including teacher mediation, repeated practice, structured worksheets, and digital feedback, in addition to the role of comments themselves.
Future research should therefore build on this study through larger-scale and more robust designs. In particular, future studies could: (i) replicate the intervention with larger and more diverse samples; (ii) compare comment-based scaffolding with other reflective supports such as pseudocode, flowcharts, or verbal self-explanation; (iii) include control or comparison groups to isolate the specific contribution of comments; and (iv) investigate longer-term effects on code quality, independent problem solving, debugging performance, and transfer to more advanced programming tasks. It would also be valuable to explore whether similar gains can be observed in other educational contexts, including general secondary education, higher education, and hybrid or online learning environments.
In conclusion, this exploratory classroom-based study suggests that code comments, when intentionally integrated into a digitally supported pedagogical design, may represent a simple yet pedagogically meaningful strategy for supporting computational thinking and introductory programming learning among novice students. In the specific context of vocational secondary education, where accessible, structured, and transferable teaching approaches are especially valuable, the findings indicate that comments can function as a useful learning scaffold and as a bridge between programming practice and reflective understanding. However, these conclusions should be interpreted as context-specific and practice-based rather than as evidence of isolated causal effectiveness.

Author Contributions

Conceptualization, G.S. and M.J.C.S.R.; methodology, G.S. and M.J.C.S.R.; formal analysis, G.S. and M.J.C.S.R.; investigation, G.S.; data curation, G.S.; writing—original draft preparation, G.S.; writing—review and editing, M.J.C.S.R.; supervision, M.J.C.S.R. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Ethical review and approval were waived for this survey by the University of Trás-os-Montes e Alto Douro on 4 May 2026.

Informed Consent Statement

Subject consent was waived due to the fact that the survey was anonymous. The survey is anonymous. The questionnaire will be used only for collective analysis. There is no need to complete the survey. By completing the questionnaire, you agree to participate in the study.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

Portions of this manuscript—such as section outlines and preliminary table drafts—were developed with the assistance of the ChatGPT 5.2 language model. The authors used this tool to support clarity and improve the linguistic quality of the manuscript. All content generated with AI assistance was critically reviewed, edited, and validated by the authors, who take full responsibility for the final version of the publication.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Weeda, R.; Smetsers, S.; Barendsen, E. Unraveling Novices’ Code Composition Difficulties. Comput. Sci. Educ. 2024, 34, 414–441. [Google Scholar] [CrossRef]
  2. Cheah, C.S. Factors Contributing to the Difficulties in Teaching and Learning of Computer Programming: A Literature Review. Contemp. Educ. Technol. 2020, 12, ep272. [Google Scholar] [CrossRef] [PubMed]
  3. Åkerfeldt, A.; Kjällander, S.; Petersen, P. A Research Review of Computational Thinking and Programming in Education. Technol. Pedagog. Educ. 2024, 33, 375–390. [Google Scholar] [CrossRef]
  4. Wing, J.M. Computational Thinking. Commun. ACM 2006, 49, 33–35. [Google Scholar] [CrossRef]
  5. Wing, J. Computational Thinking’s Influence on Research and Education for All. Ital. J. Educ. Technol. 2017, 1, 7–14. [Google Scholar] [CrossRef]
  6. Li, Y.; Schoenfeld, A.H.; diSessa, A.A.; Graesser, A.C.; Benson, L.C.; English, L.D.; Duschl, R.A. Computational Thinking Is More about Thinking than Computing. J. STEM Educ. Res. 2020, 3, 1–18. [Google Scholar] [CrossRef]
  7. Ocampo, L.M.; Corrales-Álvarez, M.; Cardona-Torres, S.A.; Zapata-Cáceres, M. Systematic Review of Instruments to Assess Computational Thinking in Early Years of Schooling. Educ. Sci. 2024, 14, 1124. [Google Scholar] [CrossRef]
  8. Fiorella, L.; Mayer, R.E. Eight Ways to Promote Generative Learning. Educ. Psychol. Rev. 2016, 28, 717–741. [Google Scholar] [CrossRef]
  9. Muldner, K.; Jennings, J.; Chiarelli, V. A Review of Worked Examples in Programming Activities. ACM Trans. Comput. Educ. 2022, 23, 1–35. [Google Scholar] [CrossRef]
  10. Loksa, D.; Ko, A.J.; Jernigan, W.; Oleson, A.; Mendez, C.J.; Burnett, M.M. Programming, Problem Solving, and Self-Awareness: Effects of Explicit Guidance. In Proceedings of the 2016 CHI Conference on Human Factors in Computing Systems, San Jose, CA, USA, 7–12 May 2016; Association for Computing Machinery: New York, NY, USA, 2016; pp. 1449–1461. [Google Scholar]
  11. Vieira, C.; Roy, A.; Magana, A.; Falk, M.; Reese, M. In-Code Comments as a Self-Explanation Strategy for Computational Science Education. In Proceedings of the 2016 ASEE Annual Conference & Exposition Proceedings, New Orleans, LA, USA, 26–29 June 2016; ASEE Conferences: Washington, DC, USA, 2016; p. 25642. [Google Scholar]
  12. Vieira, C.; Magana, A.J.; Roy, A.; Falk, M.L. Student Explanations in the Context of Computational Science and Engineering Education. Cogn. Instr. 2019, 37, 201–231. [Google Scholar] [CrossRef]
  13. Vieira, C.; Magana, A.J.; Falk, M.L.; Garcia, R.E. Writing In-Code Comments to Self-Explain in Computational Science and Engineering Education. ACM Trans. Comput. Educ. 2017, 17, 1–21. [Google Scholar] [CrossRef]
  14. Kerschbaumer, D.; Schatz, C.; Ruprechter, T.; Gütl, C.; Steinmaurer, A. Do Comments Matter? Investigating Students’ Source Code Comment Behaviour and Its Relation to Academic Success in a CS1 Course. In International Conference on Interactive Collaborative Learning; Springer Nature: Cham, Switzerland, 2024. [Google Scholar] [CrossRef]
  15. Izu, C.; Mirolo, C.; Börstler, J.; Connamacher, H.; Crosby, R.; Glassey, R.; Haldeman, G.; Kiljunen, O.; Kumar, A.N.; Liu, D.; et al. Introducing Code Quality in the CS1 Classroom. In Proceedings of the 2024 on Innovation and Technology in Computer Science Education V. 2, Milan, Italy, 8–10 July 2024; Association for Computing Machinery: New York, NY, USA, 2024; pp. 773–774. [Google Scholar]
  16. Izu, C.; Mirolo, C.; Börstler, J.; Connamacher, H.; Crosby, R.; Glassey, R.; Haldeman, G.; Kiljunen, O.; Kumar, A.N.; Liu, D.; et al. Introducing Code Quality at CS1 Level: Examples and Activities. In Proceedings of the 2024 Working Group Reports on Innovation and Technology in Computer Science Education, Milan, Italy, 5–10 July 2024; Association for Computing Machinery: New York, NY, USA, 2025; pp. 339–377. [Google Scholar]
  17. Lehtinen, T.; Lukkarinen, A.; Haaranen, L. Students Struggle to Explain Their Own Program Code. In Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education V. 1, Virtual, 26 June–1 July 2021; Association for Computing Machinery: New York, NY, USA, 2021; pp. 206–212. [Google Scholar]
  18. Rani, P.; Blasi, A.; Stulova, N.; Panichella, S.; Gorla, A.; Nierstrasz, O. A Decade of Code Comment Quality Assessment: A Systematic Literature Review. J. Syst. Softw. 2023, 195, 111515. [Google Scholar] [CrossRef]
  19. Oliveira, D.; Santos, R.; De Oliveira, B.; Monperrus, M.; Castor, F.; Madeiral, F. Understanding Code Understandability Improvements in Code Reviews. IEEE Trans. Softw. Eng. 2025, 51, 14–37. [Google Scholar] [CrossRef]
  20. Hermans, S.; Neutens, T.; Wyffels, F.; Van Petegem, P. Empowering Vocational Students: A Research-Based Framework for Computational Thinking Integration. Educ. Sci. 2024, 14, 206. [Google Scholar] [CrossRef]
  21. Weintrop, D.; Beheshti, E.; Horn, M.; Orton, K.; Jona, K.; Trouille, L.; Wilensky, U. Defining Computational Thinking for Mathematics and Science Classrooms. J. Sci. Educ. Technol. 2016, 25, 127–147. [Google Scholar] [CrossRef]
  22. Paiva, J.C.; Leal, J.P.; Figueira, Á. Automated Assessment in Computer Science Education: A State-of-the-Art Review. ACM Trans. Comput. Educ. 2022, 22, 1–40. [Google Scholar] [CrossRef]
  23. Kirschner, P.A.; Sweller, J.; Clark, R.E. Why Minimal Guidance During Instruction Does Not Work: An Analysis of the Failure of Constructivist, Discovery, Problem-Based, Experiential, and Inquiry-Based Teaching. Educ. Psychol. 2006, 41, 75–86. [Google Scholar] [CrossRef]
  24. Qian, Y.; Lehman, J. Students’ Misconceptions and Other Difficulties in Introductory Programming: A Literature Review. ACM Trans. Comput. Educ. 2017, 18, 1–24. [Google Scholar] [CrossRef]
  25. Prather, J.; Pettit, R.; McMurry, K.; Peters, A.; Homer, J.; Cohen, M. Metacognitive Difficulties Faced by Novice Programmers in Automated Assessment Tools. In Proceedings of the 2018 ACM Conference on International Computing Education Research, Helsinki, Finland, 13–15 August 2018; Association for Computing Machinery: New York, NY, USA, 2018; pp. 41–50. [Google Scholar]
  26. Arakawa, K.; Hao, Q.; Greer, T.; Ding, L.; Hundhausen, C.D.; Peterson, A. In Situ Identification of Student Self-Regulated Learning Struggles in Programming Assignments. In Proceedings of the 52nd ACM Technical Symposium on Computer Science Education, Virtual, 13–20 March 2021; Association for Computing Machinery: New York, NY, USA, 2021; pp. 467–473. [Google Scholar]
  27. Xie, B.; Lim, J.O.; Pham, P.K.D.; Li, M.; Ko, A.J. Developing Novice Programmers’ Self-Regulation Skills with Code Replays. In Proceedings of the 2023 ACM Conference on International Computing Education Research, Kagawa, Japan, 7–9 August 2023; Association for Computing Machinery: New York, NY, USA, 2023; Volume 1, pp. 298–313. [Google Scholar]
  28. Liu, Z.; Gearty, Z.; Richard, E.; Orrill, C.H.; Kayumova, S.; Balasubramanian, R. Bringing Computational Thinking into Classrooms: A Systematic Review on Supporting Teachers in Integrating Computational Thinking into K-12 Classrooms. Int. J. STEM Educ. 2024, 11, 51. [Google Scholar] [CrossRef]
  29. Niazi, T.; Das, T.; Ahmed, G.; Waqas, S.M.; Khan, S.; Khan, S.; Abdelatif, A.A.; Wasi, S. Investigating Novice Developers’ Code Commenting Trends Using Machine Learning Techniques. Algorithms 2023, 16, 53. [Google Scholar] [CrossRef]
  30. Thangaraj, J.; Ward, M.; O’Riordan, F. A Systematic Review of Formative Assessment to Support Students Learning Computer Programming. In Proceedings of the 4th International Computer Programming Education Conference (ICPEC 2023), Kagawa, Japan, 7–9 August 2023; Peixoto de Queirós, R.A., Teixeira Pinto, M.P., Eds.; Schloss Dagstuhl—Leibniz-Zentrum für Informatik: Dagstuhl, Germany, 2023; Volume 112, pp. 1–13. [Google Scholar]
  31. Alasmari, O.A.; Singer, J.; Bikanga Ada, M. Do Current Online Coding Tutorial Systems Address Novice Programmer Difficulties? In Proceedings of the 15th International Conference on Education Technology and Computers, Barcelona, Spain, 26–28 September 2023; Association for Computing Machinery: New York, NY, USA, 2024; pp. 242–248. [Google Scholar]
  32. Tariq, R.; Aponte Babines, B.M.; Ramirez, J.; Alvarez-Icaza, I.; Naseer, F. Computational Thinking in STEM Education: Current State-of-the-Art and Future Research Directions. Front. Comput. Sci. 2025, 6, 1480404. [Google Scholar] [CrossRef]
  33. Zviel-Girshin, R. The Good and Bad of AI Tools in Novice Programming Education. Educ. Sci. 2024, 14, 1089. [Google Scholar] [CrossRef]
  34. Marín-Marín, J.-A.; García-Tudela, P.A.; Duo-Terrón, P. Computational Thinking and Programming with Arduino in Education: A Systematic Review for Secondary Education. Heliyon 2024, 10, e29177. [Google Scholar] [CrossRef]
Figure 1. Comparison of students’ performance by computational thinking concept before and after the intervention.
Figure 1. Comparison of students’ performance by computational thinking concept before and after the intervention.
Digital 06 00037 g001
Figure 2. Comparison of students’ mean performance by computational thinking pillar before and after the intervention.
Figure 2. Comparison of students’ mean performance by computational thinking pillar before and after the intervention.
Digital 06 00037 g002
Figure 3. Mean pre- and post-intervention scores for the four Likert-type items in the Practice subsection of the questionnaire on code comments (Items 4–7). In all four items, post-intervention means are higher than pre-intervention means, indicating a consistent positive shift in students’ self-reported commenting practices.
Figure 3. Mean pre- and post-intervention scores for the four Likert-type items in the Practice subsection of the questionnaire on code comments (Items 4–7). In all four items, post-intervention means are higher than pre-intervention means, indicating a consistent positive shift in students’ self-reported commenting practices.
Digital 06 00037 g003
Table 1. Descriptive statistics for the pre- and post-intervention Computational Thinking (CT) test (maximum score = 28).
Table 1. Descriptive statistics for the pre- and post-intervention Computational Thinking (CT) test (maximum score = 28).
StatisticPre-TestPost-Test
Mean score12.025.4
Mean percentage (%)42.990.7
Standard deviation3.231.90
Median12.526.0
Minimum822
Maximum1728
Average gain+13.4 points
Table 2. Pre- and post-intervention results of the Computational Thinking test by concept.
Table 2. Pre- and post-intervention results of the Computational Thinking test by concept.
ConceptProgramming ConceptPre-Test (%)Post-Test (%)Gain (p.p.)
C1Simple instructions and sequences83100+18
C2Repetition structures (repeat)85100+15
C3Repetition structures (repeat until)68100+33
C4Simple conditionals (if)2095+75
C5Compound conditionals (if-else)2093+73
C6Repetition structures (while)1568+53
C7Basic functions1380+68
Table 3. Pre- and post-intervention results by the four pillars of computational thinking.
Table 3. Pre- and post-intervention results by the four pillars of computational thinking.
PillarPre-Test MeanPost-Test MeanGainPre-Test VariancePost-Test VariancePre-/Post-Test SD
Abstraction0.390.89+0.500.130.020.36/0.15
Decomposition0.390.89+0.500.110.020.33/0.15
Pattern recognition0.380.90+0.520.120.020.34/0.14
Algorithmic thinking0.430.91+0.480.120.020.35/0.14
Table 4. Structure of the pre-/post-intervention questionnaire on code comments and analytical treatment by domain.
Table 4. Structure of the pre-/post-intervention questionnaire on code comments and analytical treatment by domain.
DomainItem(s)Content FocusResponse FormatAnalytical Treatment in This Study
Knowledge about code commentsQ1Familiarity with the concept of code commentsDichotomous (Yes/No)Descriptive frequencies (pre/post)
Knowledge about code commentsQ2Distinguishing inline vs. block commentsOpen-endedQualitative categorical coding and pre/post comparison
Knowledge about code commentsQ3Defining what a code comment isOpen-endedQualitative categorical coding and pre/post comparison
Practice of using code commentsQ4Frequency of writing comments in own code5-point Likert-type
(1 = never; 5 = always)
Descriptive item-level comparison; included in exploratory practice subsection score
Practice of using code commentsQ5Comments facilitate later code comprehension5-point Likert-type
(1 = strongly disagree; 5 = strongly agree)
Descriptive item-level comparison; included in exploratory practice subsection score
Practice of using code commentsQ6Comments support reflective learning5-point Likert-type
(1 = strongly disagree; 5 = strongly agree)
Descriptive item-level comparison; included in exploratory practice subsection score
Practice of using code commentsQ7Comments help students think and plan while programming5-point Likert-type
(1 = strongly disagree; 5 = strongly agree)
Descriptive item-level comparison; included in exploratory practice subsection score
Perceptions of code commentsQ8What students usually write in commentsOpen-endedQualitative thematic/categorical coding
Perceptions of code commentsQ9Perceived benefits of comments in programming learningOpen-endedQualitative thematic/categorical coding
Perceptions of code commentsQ10Difficulties encountered when writing commentsOpen-endedQualitative thematic/categorical coding
Perceptions of code commentsQ11Suggestions to improve comment-writing for learningOpen-endedQualitative thematic/categorical coding
Table 5. Pre- and post-intervention descriptive and inferential results for the four Likert-type items in the Practice subsection of the questionnaire on code comments (Items 4–7), showing a consistent positive shift in students’ self-reported commenting practices.
Table 5. Pre- and post-intervention descriptive and inferential results for the four Likert-type items in the Practice subsection of the questionnaire on code comments (Items 4–7), showing a consistent positive shift in students’ self-reported commenting practices.
ItemPractice Subsection ItemPre-Test MeanPost-Test MeanGain
Q4Frequency of writing comments in own code2.74.6+1.9
Q5Comments facilitate later code comprehension2.54.4+1.9
Q6Comments support reflective learning2.14.2+2.1
Q7Comments help students think and plan while programming3.04.7+1.7
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Sarmento, G.; Reis, M.J.C.S. Using Code Comments as a Pedagogical Scaffold in Digitally Supported Introductory Programming: An Exploratory Mixed-Methods Study in Vocational Secondary Education. Digital 2026, 6, 37. https://doi.org/10.3390/digital6020037

AMA Style

Sarmento G, Reis MJCS. Using Code Comments as a Pedagogical Scaffold in Digitally Supported Introductory Programming: An Exploratory Mixed-Methods Study in Vocational Secondary Education. Digital. 2026; 6(2):37. https://doi.org/10.3390/digital6020037

Chicago/Turabian Style

Sarmento, Gonçalo, and Manuel J. C. S. Reis. 2026. "Using Code Comments as a Pedagogical Scaffold in Digitally Supported Introductory Programming: An Exploratory Mixed-Methods Study in Vocational Secondary Education" Digital 6, no. 2: 37. https://doi.org/10.3390/digital6020037

APA Style

Sarmento, G., & Reis, M. J. C. S. (2026). Using Code Comments as a Pedagogical Scaffold in Digitally Supported Introductory Programming: An Exploratory Mixed-Methods Study in Vocational Secondary Education. Digital, 6(2), 37. https://doi.org/10.3390/digital6020037

Article Metrics

Back to TopTop