Using Code Comments as a Pedagogical Scaffold in Digitally Supported Introductory Programming: An Exploratory Mixed-Methods Study in Vocational Secondary Education
Abstract
1. Introduction
- 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?
2. Theoretical Background
2.1. Computational Thinking in Introductory Programming Education
2.2. Code Comments as Pedagogical Scaffolding
2.3. Digital and Multimedia-Supported Learning in Programming Education
3. Materials and Methods
3.1. Research Design
3.2. Context and Participants
3.3. Pedagogical Intervention
- 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.
- 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.
3.4. Digital Learning Resources and Instructional Materials
- 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.
3.5. Data Collection Instruments
3.5.1. Computational Thinking Test
3.5.2. Questionnaire on Code Comments
3.5.3. Classroom Artifacts and Qualitative Evidence
3.6. Data Analysis Procedures
3.6.1. Analysis of the Computational Thinking Test
3.6.2. Analysis of the Questionnaire on Code Comments
3.6.3. Analysis of Classroom Artifacts and Qualitative Triangulation
3.6.4. Integrated Interpretation
4. Results
4.1. Computational Thinking Test Results
4.2. Questionnaire Results on Code Comments
4.2.1. Knowledge About Code Comments
4.2.2. Practice of Using Code Comments
4.2.3. Perceptions of Code Comments
4.3. Synthesis of Findings
5. Discussion
5.1. Code Comments as Cognitive and Metacognitive Scaffolds
5.2. Implications for Digital Learning in Introductory Programming
5.3. Relevance for Vocational Secondary Education
5.4. Limitations
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Weeda, R.; Smetsers, S.; Barendsen, E. Unraveling Novices’ Code Composition Difficulties. Comput. Sci. Educ. 2024, 34, 414–441. [Google Scholar] [CrossRef]
- 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]
- Å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]
- Wing, J.M. Computational Thinking. Commun. ACM 2006, 49, 33–35. [Google Scholar] [CrossRef]
- Wing, J. Computational Thinking’s Influence on Research and Education for All. Ital. J. Educ. Technol. 2017, 1, 7–14. [Google Scholar] [CrossRef]
- 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]
- 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]
- Fiorella, L.; Mayer, R.E. Eight Ways to Promote Generative Learning. Educ. Psychol. Rev. 2016, 28, 717–741. [Google Scholar] [CrossRef]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- Zviel-Girshin, R. The Good and Bad of AI Tools in Novice Programming Education. Educ. Sci. 2024, 14, 1089. [Google Scholar] [CrossRef]
- 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]



| Statistic | Pre-Test | Post-Test |
|---|---|---|
| Mean score | 12.0 | 25.4 |
| Mean percentage (%) | 42.9 | 90.7 |
| Standard deviation | 3.23 | 1.90 |
| Median | 12.5 | 26.0 |
| Minimum | 8 | 22 |
| Maximum | 17 | 28 |
| Average gain | +13.4 points | |
| Concept | Programming Concept | Pre-Test (%) | Post-Test (%) | Gain (p.p.) |
|---|---|---|---|---|
| C1 | Simple instructions and sequences | 83 | 100 | +18 |
| C2 | Repetition structures (repeat) | 85 | 100 | +15 |
| C3 | Repetition structures (repeat until) | 68 | 100 | +33 |
| C4 | Simple conditionals (if) | 20 | 95 | +75 |
| C5 | Compound conditionals (if-else) | 20 | 93 | +73 |
| C6 | Repetition structures (while) | 15 | 68 | +53 |
| C7 | Basic functions | 13 | 80 | +68 |
| Pillar | Pre-Test Mean | Post-Test Mean | Gain | Pre-Test Variance | Post-Test Variance | Pre-/Post-Test SD |
|---|---|---|---|---|---|---|
| Abstraction | 0.39 | 0.89 | +0.50 | 0.13 | 0.02 | 0.36/0.15 |
| Decomposition | 0.39 | 0.89 | +0.50 | 0.11 | 0.02 | 0.33/0.15 |
| Pattern recognition | 0.38 | 0.90 | +0.52 | 0.12 | 0.02 | 0.34/0.14 |
| Algorithmic thinking | 0.43 | 0.91 | +0.48 | 0.12 | 0.02 | 0.35/0.14 |
| Domain | Item(s) | Content Focus | Response Format | Analytical Treatment in This Study |
|---|---|---|---|---|
| Knowledge about code comments | Q1 | Familiarity with the concept of code comments | Dichotomous (Yes/No) | Descriptive frequencies (pre/post) |
| Knowledge about code comments | Q2 | Distinguishing inline vs. block comments | Open-ended | Qualitative categorical coding and pre/post comparison |
| Knowledge about code comments | Q3 | Defining what a code comment is | Open-ended | Qualitative categorical coding and pre/post comparison |
| Practice of using code comments | Q4 | Frequency of writing comments in own code | 5-point Likert-type (1 = never; 5 = always) | Descriptive item-level comparison; included in exploratory practice subsection score |
| Practice of using code comments | Q5 | Comments facilitate later code comprehension | 5-point Likert-type (1 = strongly disagree; 5 = strongly agree) | Descriptive item-level comparison; included in exploratory practice subsection score |
| Practice of using code comments | Q6 | Comments support reflective learning | 5-point Likert-type (1 = strongly disagree; 5 = strongly agree) | Descriptive item-level comparison; included in exploratory practice subsection score |
| Practice of using code comments | Q7 | Comments help students think and plan while programming | 5-point Likert-type (1 = strongly disagree; 5 = strongly agree) | Descriptive item-level comparison; included in exploratory practice subsection score |
| Perceptions of code comments | Q8 | What students usually write in comments | Open-ended | Qualitative thematic/categorical coding |
| Perceptions of code comments | Q9 | Perceived benefits of comments in programming learning | Open-ended | Qualitative thematic/categorical coding |
| Perceptions of code comments | Q10 | Difficulties encountered when writing comments | Open-ended | Qualitative thematic/categorical coding |
| Perceptions of code comments | Q11 | Suggestions to improve comment-writing for learning | Open-ended | Qualitative thematic/categorical coding |
| Item | Practice Subsection Item | Pre-Test Mean | Post-Test Mean | Gain |
|---|---|---|---|---|
| Q4 | Frequency of writing comments in own code | 2.7 | 4.6 | +1.9 |
| Q5 | Comments facilitate later code comprehension | 2.5 | 4.4 | +1.9 |
| Q6 | Comments support reflective learning | 2.1 | 4.2 | +2.1 |
| Q7 | Comments help students think and plan while programming | 3.0 | 4.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. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
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
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 StyleSarmento, 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 StyleSarmento, 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
