Figure 1: A section of a python code program. Programming languages have certainly improved since their inception, but the question remains: how do humans cognitively perceive code?
Source: Pixabay
Computer science, the study of computers and computing, has experienced colossal changes over the last half-millennium: from Charles Babbage’s 1823 invention of the difference engine with a measly 20-decimal capacity, meaning that the engine could perform certain mathematical computations to twenty decimals, to today’s age where many individuals own computers with vast processing speeds (Gregersen, 2020). These computing machines require a set of instructions to run, and thus computer programming has grown in tandem with computer science. Popular programming languages like Python, C#, C++, and ScratchJr have emerged and have aided in the creation of ubiquitous applications. Modern computer programming has grown to be a practical skill that is globally practiced and appreciated. Multiple education systems around the world incorporate computer science in their curricula for this reason (Smith, 2016). Still, on the cognitive level, computer code comprehension remains a mystery. What constitutes comprehension of these programming languages? What goes into computational thinking or a algorithmic approach towards problem-solving?
There have been two main theories proposed as to how humans perceive and understand programming languages (Fedorenko et al., 2019). Some experts consider programming languages to be more math-oriented and as such often group them with science-oriented fields like mathematics and engineering. In this case, programming languages are thought to evoke the Multiple Demand (MD) system (part of frontal and parietal area of the human brain) (Duncan, 2010), which is recruited during math, logic, problem-solving, and executive tasks. Others view computer programming as another natural language, arguing that the structure of programming languages closely resembles that of natural languages such as English. In this case, processing programming languages is thought to activate the language system which is mostly evoked when processing (reading and writing) natural languages (Ivanova et al., 2020).
Both natural and programming languages rely on smaller building blocks to represent larger quantities of information. More specifically, (arguably) all programming languages rely on functions and variables which are closely tied to words and phrases in natural languages (Fedorenko et al., 2019). Moreover, keywords in programming languages are written in natural languages and use concepts that are familiar to natural languages, such as “int” (which stands for integer), “cin” (short for character input), “print”, “while”, and “for”. Despite this, programming languages (in the form of code) mostly execute mathematical commands. Comprehending what code does in most cases requires a basic understanding of mathematical concepts and elements such as exponents, addition, and subtraction. It is not uncommon to find mathematical characters such as +, -, /, and * inside particular codes. With these arguments in mind, it remains unclear which part of the brain is recruited by computer code comprehension.
According to renowned American Linguist, Noam Chomsky’s Universal Grammar, acquisition and comprehension of natural language are innate. If the “programming languages as natural languages” theory is correct, might this apply to all programming languages? Do humans have a predisposition to acquiring knowledge of programming languages like Python?
Anna Ivanova and her team at MIT’s Department of Brain and Cognitive Sciences sought to investigate which particular brain region is activated during code comprehension, and by extension, whether programming languages can be classified with natural languages. For this experiment, Ivanova et al. utilized two very different programming languages – Python (a more general-purpose, script-based language) and Scratch Jr (a low-level and more visual programming language often taught to children). Participants (who knew both languages) were placed in an MRI scanner and asked to read either a code problem or a content-matched sentence problem and then predict the output. A content-matched sentence problem could be a sentence like, “Dog walks left, jumps and then walks right” while a code problem could be the same instructions as above but programmed in one’s computer language of choice (e.g., Scratch Jr.). Surprisingly, the study found that code comprehension recruited both hemispheres of the MD system and little to no areas of the language system, suggesting that neither the view of coding as a pure logic exercise nor as a natural language are completely correct. After all, math and logic recruit the left side of the MD system and, despite the user-friendly and easy-to-read nature of Python and ScratchJr and their structural similarity to natural languages, the brain did not recruit its language system (Ivanova et al., 2020).
Although Ivanova et al.’s study is a crucial step towards understanding computational thinking in humans, it barely scratches the surface. Beyond just reading code (as in the Ivanova et al. study), many elements, such as the editing and debugging that go into coding and software development, play a role in computational thinking but have not yet been investigated fully. Moreover, since Ivanova et al. recruited fairly young participants, it would be interesting to find out how prolonged coding, such as in individuals with 25+ years of experience, affects the anatomy of the human brain (Ivanova et al., 2020).
Still, studying individual anatomical differences can in some way help globally shape the education system. The teaching of computer science will need to be re-conceptualized to model how best our brains respond to the acquisition of programming languages. For instance, studies could help determine the best age to start learning programming languages or developing computer science courses taught in English in a manner that benefits non-native English speakers. (Fedorenko et al., 2019).
References
Chomsky’s Universal Grammar. (n.d.). Retrieved April 3, 2021, from https://thebrain.mcgill.ca/flash/capsules/outil_rouge06.html
Duncan, J. (2010). The multiple-demand (MD) system of the primate brain: Mental programs for intelligent behaviour. Trends in Cognitive Sciences, 14(4), 172–179. https://doi.org/10.1016/j.tics.2010.01.004
Fedorenko, E., Ivanova, A., Dhamala, R., & Bers, M. (2019). The Language of Programming: A Cognitive Perspective. Trends in Cognitive Sciences, 23. https://doi.org/10.1016/j.tics.2019.04.010
Gregersen, E. (2020). Charles Babbage | Biography, Computers, Inventions, & Facts | Britannica. Britannica. https://www.britannica.com/biography/Charles-Babbage
Ivanova, A. A., Srikant, S., Sueoka, Y., Kean, H. H., Dhamala, R., O’Reilly, U.-M., Bers, M. U., & Fedorenko, E. (2020). Comprehension of computer code relies primarily on domain-general executive brain regions. ELife, 9, e58906. https://doi.org/10.7554/eLife.58906
Smith, M. (2016, January 30). Computer Science for All. Whitehouse.Gov. https://obamawhitehouse.archives.gov/blog/2016/01/30/computer-science-all
Related Posts
Could This Be the First Drug to Slow the Progression of Alzheimer’s?
Figure 1: A cross section of a model brain Source: unsplash.com...
Read MoreNeuroscience, Narrative, and Never-Ending Stories
Figure 1: A field of poppies. The myths of Persephone...
Read MoreCOVID-19 May Inflict Lasting Damage on the Central Nervous System
Figure 1: Transmission electron microscope image of the SARS-CoV-2 virus....
Read MoreCollins Kariuki