Programming 'language': Brain scans reveal coding uses same regions as speech
What goes on in the minds of programmers when they write software? This was the question posed by Prof. Dr. Janet Siegmund, Chair of Software Engineering at Chemnitz University of Technology, Prof. Dr. Sven Apel, Chair of Software Engineering at Saarland University and Dr. André Brechmann, head of the special laboratory for non-invasive imaging at the Leibniz Institute of Neurobiology in Magdeburg. To find out, the researchers used imaging techniques from the neurosciences and investigated which brain areas are activated when reading and understanding computer programs. Their amazing result: Programming is like talking. They found out that the brain regions that are most active are those that are also relevant in the processing of natural language.
They have now published the results of their basic research in the renowned journal Communications of the ACM, which is published by the world's largest professional association for computer science. Lead author was Janet Siegmund from Chemnitz University of Technology. The findings could have far-reaching consequences in the design of programming languages, programming education, or answering fundamental questions—such as what constitutes complicated or simple program code.
New research approach—First brain analysis in programming
"The idea for our research question arose in Magdeburg during a joint meeting of researchers from the Leibniz Institute of Neurobiology and the Faculty of Informatics in Magdeburg," said Janet Siegmund. In several small and large pilot studies, supported by Prof Kästner (Carnegie Mellon University) and Prof Parnin (North Carolina State University), the researchers developed a versatile methodological basis. This effort was worthwhile, because in the meantime, the methodology developed by Siegmund and her colleagues is on its way to becoming a standard and has already proven itself in international studies.
"Our goal was to develop a completely new approach to better understand the cognitive processes involved in programming," says Sven Apel from Saarbrücken. Siegmund, Apel, and Brechmann made the brain activity of programmers visible for the first time while they analyzed several lines of code. In doing so, the scientists worked together like a unit that complemented each other. While Brechmann, as an experienced neuroscientist, contributed his experience with experiments in functional magnetic resonance imaging (fMRI) and Apel, as an experienced researcher, contributed his expertise in software development, Siegmund, with her interdisciplinary expertise in psychology and computer science, acted as a link.
Research design on the way to the standard
For the study, the team used the subtraction method, which has proven itself in neuroscience: In this method, the the subjects first work on a task in the magnetic resonance tomograph, for the solution of which they have to understand an extract of the program code. After a short rest period, they were asked to check a code snippet for simple syntax errors, which is a routine task for programmers, meaning it was not a question of understanding. This procedure was repeated several times. Subsequently, the images of brain activity during the processing of the routine task were subtracted from the images of the comprehension test—what remained were the brain regions that are of particular importance for the process of program comprehension.
To see what happens in the brain during this process, the team used a functional magnetic resonance tomograph. The image data clearly showed activation in the test subjects' left brain areas, which are mainly associated with speech comprehension. "To our surprise, we could not observe any activity in the direction of mathematical or logical thinking," said the researcher summarizing the results. "Our research suggests that speech understanding plays a central role in programming. The renowned Dutch computer scientist Edsger W. Dijkstra already expressed this assumption in the 1980s," Apel adds.
The research design has since been taken up by research groups around the world and expanded to include additional aspects. The research team assumes that the results could also feed back into neuroscience by discovering new cognitive processes that differ, for example, from reading comprehension and logical reasoning.
The team led by Siegmund, Apel and Brechmann is now hoping to find out how the understanding of programs differs between experts and beginners—whether they read and interpret program code in different ways.
More information: Janet Siegmund et al. Studying programming in the neuroage, Communications of the ACM (2020). DOI: 10.1145/3347093