Is learning computer programming associated with developing thinking skills?

Is learning computer programming associated with developing thinking skills?
Author/s:
Professor, Institute of Education at the National University of Hurlingham (Universidad Nacional de Hurlingham -UNAHUR-), and a researcher at the National Council of Scientific and Technical Research, Argentina.
Theme/s:

Emerging technologies and learning

This report arises from Science of Learning Fellowships funded by the International Brain Research Organization (IBRO) in partnership with the International Bureau of Education (IBE) of the United Nations Educational, Scientific and Cultural Organization (UNESCO). The IBRO/IBE-UNESCO Science of Learning Fellowship aims to support and translate key neuroscience research on learning and the brain to educators, policy makers, and governments.

Executive Summary

  • Computer programming is being introduced in curricula worldwide.
  • One of the main arguments for its inclusion is the claim that learning computer programming is learning how to think.
  • As learning to think can be thought of as the main objective of school it is reasonable to wonder if such a strong claim is sustained. Here, we review evidence on the topic from psychology and education, cognitive science behavioral studies, and neuroscience.
  • Evidence from psychology and education, although generally showing a positive transfer of programming to other cognitive domains, is not conclusive.
  • Available evidence of behavioral studies conducted in classrooms, although still few, indicates that teaching programming trains executive functions (EFs), the cognitive processes needed to think.
  • Brain studies analyzing brain activation during programming tasks, are still far from being enough to answer the question.
  • The available evidence from psychology, education and cognitive science, although still not conclusive, is in line with the claim that learning programming is learning to think. Neuroscientific studies, still are not enough to inform any answer to this question.

Learning programming seen as learning how to think

Teaching computer science (see Figure A1 in the appendix for a definition of this and other technical terms used in this brief) at schools is almost universally accepted. Most countries are moving towards its inclusion in the curricula through programming[1] (eg, Estonia, Greece, England, Singapore, Philippines, South Africa, Qatar Australia)1, enabled by the availability of programming tools and curricula appropriate for younger learners2. Further, there are also some countries that started to teach programming even from kindergarten1.

The main reason for that educational decision is that computers are pervasive in our everyday experience, and not knowing how they work means taking for granted an increasing part of our surrounding reality, not being able to decompose what we see, nor being able to question it3. In other words, digital literacy is not enough anymore; to engage in many basic aspects of common life (not in the mere role of users, but in the role of producers) we need a basic understanding of programming[2].

But besides the understanding of the digital world, the famous Steve Jobs’ quote “Everybody should learn to program because it teaches you how to think” embodies another powerful argument: learning to program could have other potential cognitive benefits. The question is whether programming can support broader critical thinking and higher-order reasoning, that goes besides specifically about the programming knowledge itself. This claim is a core debate nowadays and a topic of interest for policy makers and educators in technology across the globe (see the recent work from Scherer, Siddiq and Sánchez-Scherer4 for more detail on this debate). An important question at this point is what is the evidence regarding this? Is learning to program associated with the development of thinking skills?

Evidence from psychology and education: an important body of evidence that still is not strong or conclusive

Attempts to answer that question started at the end of the 70s, with the emergence of the first personal computers and the pioneering work of Seymour Papert5 and continues until today. Those five decades of studies, however, did not reach to a conclusive answer to the question. While some experimental and quasi-experimental studies documented low to large effects of teaching programming on cognitive skills (e.g., reasoning, creative thinking, and mathematic achievement), other studies did not find support for any transfer effect4. The diversity in the results could be produced by the variability in the cognitive outcomes and test used; the programming activities implemented; and the study design (very few experimental studies[3]). The most recent and exhaustive review of this topic analyzed 105 experimental and non-experimental studies studies6 and concluded that programming gains transfer to other cognitive skills (such as creative thinking, mathematical skills, and metacognition), but -on average- with a low effect size. The authors of that review conclude

“Our response to the question whether learning to code improves other cognitive skills is positive: Indeed, positive transfer effects can be detected. Nevertheless, learning to code has differential rather than uniform effects on other cognitive skills”6.

In sum, there is an important body of studies in psychology and education but more research needs to be done before we can have an evidence-based answer to the question from psychological and educational perspectives. But can cognitive science inform our understanding of the research question? Before answering that, let’s introduce some important concepts about cognition.

Programming and executive functions

Programming, as well as Computational Thinking (CT)[4], involves at least four skills: (a) breaking down a problem into easy steps; (b) pattern recognition[5]; (c) abstraction[6]; (d) algorithmic thinking[7] 7,8. Those programming abilities require a group of skills that are crucial for cognition: executive functions9 (Figure 1). Executive functions (EFs) are a group of cognitive processes that inhibit and manipulate thoughts and actions, leading to goal-directed behaviors, especially when learning something new10,11. EFs are also a key area of focus for education for all learners, including those in special education. There are three basic EFs10: inhibitory control (resisting habits, temptations, or distractions), working memory (mentally holding in mind and manipulating information), and cognitive flexibility (switching between mental sets). Some authors11 additionally included under the term EFs, more complex processes such as planning (creating and maintaining an appropriate sequence of steps for solving a task), reasoning, and problem-solving. In short, any thinking or reasoning process requires EFs.

It is easy to perceive links between definitions of EFs and programming (Figure 1). In the first place, as others have pointed out9,12, conceptual analysis of the processes involved in programming indicates that it requires cognitive regulation aspects of EFs. For example, breaking down the problem into easier steps requires holding in mind the whole problem while you separate it into parts; inhibition is needed to not be distracted by details when you are recognizing patterns or abstracting the problems; finally, flexibility is demanded to change the mindset between series of steps and select the best option to build an algorithm. This link between EFs and programming is in line with the results of behavioral and neural studies.

Figure 1. Examples of associations between programming and EFs

Evidence from behavioral studies conducted in the classroom: Teaching programming trains EFs

A number of studies coming from cognitive science have recently started to provide evidence for this link between programming and EFs, with findings suggesting that teaching programming also trains EFs. For example, using programming activities in typically developing first graders, Arfé, Bardanega, and Ronconi13 showed that 8 hours of educational activities improved not only coding skills but also inhibition and planning abilities. They randomly assigned 179 first-grade children with no prior experience of coding, to an experimental (coding, 5 classes) or control (standard STEM, 5 classes) instructional condition. The results show that learning programming improved children’s EFs (planning and inhibition), as measured with widely used behavioral tasks. In another study, Di Lieto and collaborators14 assigned 87 typically developing 5-to-6 years old children to a group that received educational robotics or to a waiting list. Intervention groups were organized at schools, and activities involved 20 twice-weekly sessions. Compared to the control group, the educational robotics group showed significantly better working memory and inhibition abilities.  A recent study15 also showed that teaching programming is associated with EFs improvement, even when controlling for computer use. In a cluster-randomized controlled trial15, classrooms of five-year-olds (of low and medium socioeconomic status schools) were assigned to a study group (that received programming instruction) or a control group (that received art instruction). Activities in both groups were carried out by the classroom teachers and also (this is a key point), included tablets. All children were administered a wide battery of computerized EFs tests before and after the implementation of programming or art activities. Results showed that programming activities increased children’s inhibition and flexibility significantly more than the control group in the lower socioeconomic status children (who benefited more from the intervention). This result shows that it is not the same, at the cognitive level, the use of computers to teach art than to teach programming, because only the programming activities (and not the art activities) improved executive functioning. Finally, uncontrolled studies in preschoolers16, and first graders with special needs17 also found associations between educational robotics and EFs (working memory and inhibitory control). Taken together, these results suggest that learning programming in the school would improve EFs. Given the available evidence, it is not possible to conclude with a high degree of certainty that learning programming is learning to think. Still, it is possible to conclude that learning to program seems to train EFs, the processes required for high-order thinking.

Available evidence from neural studies: still not enough to make contributions

Cognitive neuroscience research on computer programming has appeared in recent years18. Not surprisingly, most experiments showed an association between programming and activity in the executive functions networks18, i.e., neural networks used to solve any complex task.

In 2014, Siegmund and colleagues19 conducted the first study analyzing brain activity during code comprehension. They measured 17 participants’ (computer science or mathematics students) brain activity with fMRI[8] while they were reading code. They found evidence of activation of functional areas related to working memory, attention, and language comprehension. Authors conclude that their results

“provide direct evidence of the involvement of working memory and language processing in program comprehension, and suggest that, while learning programming, training working memory (necessary for many cognitive tasks), and language skills (…) might also be beneficial for programming skills”19.

This first study, very preliminary and with few participants, was the first in showing results that would suggest an association between reading code and EFs at the brain level.

However, reading code is a relatively simple task in programming: what brain areas would be activated in more complex programming activities? Castelhano and collaborators20 analyzed brain activity during code error detection (a more difficult task than code comprehension) in an fMRI study where participants (software development professionals) should detect bugs in the code. Experts detected quite well errors in the code and the neural correlate of that was the activation of neural networks associated with language processing, working memory, error detection, and decision-making. Those networks were not activated when experts have to detect errors in pseudo-code text or when experts know there was no error to detect.  In other words, when bug detection is required, activity in executive networks and language processing is observed.

Other studies also detected activation of executive networks during the comprehension of complex programs21, when programming requires memorizing variables to understand a code snippet 22, and when subjects have to distinguish between code and prose23. Further, a study24 found that brain activity in executive networks was associated with the programming expertise of the participants and with their reported expertise level. Although these studies show the activation of executive areas during programming tasks, the current neuroscientific evidence is still insufficient to answer the question posed in this brief. The few studies registering brain activity during programming are compatible with a cognitively complex activity, but neuroscience still cannot add anything to the question addressed.

Conclusion

Part of the enthusiasm for teaching programming is that learning to code can ultimately help students learn and gain skills in areas other than programming. Researchers, policymakers, and leaders in the field of computer science and education have made extensive use of this argument to include programming in school. Here, we reviewed the available evidence in this regard. Overall, the evidence supporting the cognitive benefits of learning programming is promising, but still not conclusive. The stronger evidence came from behavioral studies showing a positive transfer of programming to other cognitive domains, and from studies conducted in classrooms that associate learning to program with higher scores in EF tasks. Studies analyzing brain activation during programming tasks are still far from making contributions to answer the question. Taken together studies from all those disciplines, although there are some data suggesting that programming is a cognitively complex task that would require executive functioning, more high-quality evidence is needed to reach a definitive and detailed answer to that question.

 

[1]Programming is the formulation of computer programs to perform a given task. Although programming is sometimes used as a synonym of coding, coding can be also considered just the specific action of writing code, while programming includes also thinking about what to write. Thus, in this brief, we will use the term programming.

[2] For example, if schools just teach us how to use certain app today, with the advance of technology, that knowledge could be useless in a few years, when that app became obsolete. Instead, learning programming could give the tools to work with any app.

[3] There is a hierarchy of the quality of evidence that reflects the extent to which confidence in an estimate of the effect is adequate to support a particular recommendation. For example, studies showing an association, have lower quality than studies showing causality (known as randomized controlled trials). The various levels of strength the results obtained in scientific research can have can be summarized, from the highest quality level to the lower quality level in the following list: systematic reviews, evidence syntheses, randomized controlled trials, cohort studies, case-controlled studies, and expert opinion.

[4] Although programming and Computational Thinking are different concepts (see Figure A1 in the appendix), programming is considered the best way of teaching Computational thinking; thus, in this brief, we will make reference to programming (which includes computational thinking as it can be translated into scholarly activities).

[5] Pattern recognition is the skill of identifying patterns both in the data being used and the processes/strategies being used

[6] Abstraction is the process of making an artifact more understandable by reducing unnecessary detail. The skill in abstraction is in choosing the right detail to hide so that the problem becomes easier, without losing anything that is important.

[7] Algorithmic thinking is a way of getting to a solution through a clear definition of the steps

[8]  Functional magnetic resonance imaging uses magnetic resonance imaging to measure the tiny changes in blood flow that take place in an active part of the brain. It shows what brain areas are active during the execution of a given task.

 

References

1 Bers, M. U., González-González, C., & Armas–Torres, M. B. (2019). Coding as a playground: Promoting positive learning experiences in childhood classrooms. Comput. Educ. J, 138, 130-145.

2 Resnick, M., et al. (2009). Scratch: Programming for all. Commun. ACM, 52, 60-67.

3 Schapachnik, F. & Bonello, M. B. (2022). Ciencias de la Computación en la Escuela: Guía para Enseñar Mucho Más que a Programar. Siglo XXI: Buenos Aires.

4 Scherer R, Siddiq F, Sánchez-Scherer B. Some Evidence on the Cognitive Benefits of Learning to Code. Front Psychol. 2021 Sep 9; 12:559424. doi: 10.3389/fpsyg.2021.559424. PMID: 34566735; PMCID: PMC8458729.

5 Papert, S. (1980). Mindstorms: Children, Computers, and Powerful Ideas. Basic Books: Boston.

6 Scherer, R., Siddiq, F. & Viveros, B. S. (2018). Technology and the Mind: Does Learning to Code Improve Cognitive Skills?. In Proceedings of the Technology, Mind, and Society (pp. 1).

7 Wing, J. M. (2006). Computational thinking. Commun. ACM49(3), 33-35.

8 Wing, J. M. (2011, March 06). Computational thinking: What and why. The Link, 6, 20-23. Retrieved from http://www.cs.cmu.edu/link/research-notebook-computational-thinking-what-and-why

9 Robertson, J., Gray, S., Toye, M. & Booth, J. (2020). The relationship between executive functions and computational thinking. IJCSES, 3(4), 35-49.

10 Miyake, A., et al. (2000). The unity and diversity of executive functions and their contributions to complex “frontal lobe” tasks: A latent variable analysis. Cogn. Psychol., 41(1), 49-100. https://doi.org/10.1006/cogp.1999.0734

11 Diamond, A. (2013). Executive functions. Annu. Rev. Psychol., 64, 135-168.

12 Myers, E. K. (2021). The Role of Executive Function and Self-Regulation in the Development of Computational Thinking. In Teaching Computational Thinking and Coding to Young Children (pp. 64-83). IGI Global: Pensilvania.

13 Arfé, B., Vardanega, T. & Ronconi, L. (2020). The effects of coding on children’s planning and inhibition skills. Comput. Educ. J, 148: 103807. https://doi.org/10.1016/j.compedu.2020.103807

14 Di Lieto, M. C., et al. (2020). Empowering Executive Functions in 5-and 6-Year-Old Typically Developing Children Through Educational Robotics: An RCT Study. Front. Psychol., 10: 3084. https://doi.org/10.3389/fpsyg.2019.03084

15 Hermida, M.J., Goldin, A.P., Perez Santangelo, A., Lipina, S.J. & Schapachnik, F.P. Teaching programming improves inhibition and flexibility in low-socioeconomic-status preschoolers. Preprint at https://osf.io/s4h35/?view_only=6bce1ce66daf4855b6d63110bb495132

16 Di Lieto, M. C., et al. (2017). Educational robotics intervention on executive functions in preschool children: A pilot study. Comput. Hum. Behav., 71, 16-23. https://doi.org/10.1016/j.chb.2017.01.018

17 Di Lieto, M.C., et al. (2020). Improving Executive Functions at School in Children With Special Needs by Educational Robotics. Front. Psychol., 10, 2813.  https://doi.org/10.3389/fpsyg.2019.02813

18 Giannopoulou, P., Papalaskari, M. A. & Doukakis, S. (2020). Neuroeducation and Computer Programming: A Review. Adv Exp Med Biol, 1194, 59–66. https://doi.org/10.1007/978-3-030-32622-7_5

29 Siegmund, J., et al. (2014, May). Understanding source code with functional magnetic resonance imaging. In Proceedings of the 36th international conference on software engineering (pp. 379).

20 Castelhano, J., et al. (2019). The role of the insula in intuitive expert bug detection in computer code: an fMRI study. Brain Imaging Behav., 13(3), 623-637.

21 Nakagawa, T., et al. (2014) Quantifying programmers’ mental workload during program comprehension based on cerebral blood flow measurement: a controlled experiment. In: Companion proceedings of the 36th international conference on software engineering 2014, pp 448–451.

22 Ikutani, Y. & Uwano, H. (2014, June). Brain activity measurement during program comprehension with NIRS. In 15th IEEE/ACIS International Conference on Software Engineering, Artificial Intelligence, Networking and Parallel/Distributed Computing (SNPD) (pp. 1-6). IEEE.

23 Floyd, B., Santander, T. & Weimer, W. (2017) Decoding the representation of code in the brain: an fMRI study of code review and expertise. In: IEEE/ACM 39th international conference on software engineering, ICSE 2017, pp 175–186

24 Crk, I.; Kluthe, T. & Stefik, A. (2015) Understanding programming expertise: an empirical study of phasic brain wave changes. ACM Trans Comput-Hum Interact, 23(1):2

 

Appendix

Figure A1. Definition of core terms in computer science, and overlapping between concepts