Check out our lastest research, just published on The Journal of Neuroscience!

Learning to program “recycles” preexisting frontoparietal population codes of logical algorithms

How does the human brain, shaped by evolution long before computers existed, manage to learn something as modern as computer programming? In this new study, we explored this question by tracking students as they learned their very first programming language, Python, over a semester. We scanned their brains before and after the course to see what changed as they went from complete novice to beginning programmers.

What we found

Before students learned any programming syntax, their brains already used a preexisting reasoning network to understand the logic behind simple algorithms described in plain English. This network spans regions in the frontal and parietal parts of the brain. After they learned Python, that same network responded when they read real code.

Even more surprisingly, detailed analyses showed that this reasoning network encoded similar information about algorithm structure both before and after programming instruction. In other words, the brain did not create an entirely new “code area.” Instead, it repurposed existing neural patterns used for logical thinking.

What it means

These results support the neural recycling hypothesis — the idea that new cultural skills like reading, math, and now programming build upon preexisting neural machinery rather than starting from scratch. Much like reading adapts the brain’s mechanism for visual object recognition, programming seems to recruit the reasoning systems that humans already use for planning and logic.

This reuse may help explain why logical reasoning ability predicts how well someone learns to program, and why programming can feel like learning a new way to think, not just a new way to type.

Why this matters

Programming is one of the newest forms of literacy in human history. By studying how the brain adapts to it, we can gain insights into both education and the biology of learning. Understanding how existing neural systems are “recycled” for new purposes may also inform how we teach programming, design learning tools, or even develop artificial intelligence systems inspired by human cognition.

This image is an artistic visualization of how the brain represents the logic of computer programs. The colors show how strongly different brain areas encode algorithmic information. The top pair of brain maps shows encoding strength when participants read real Python code, and the bottom pair shows encoding strength for the same algorithms written in plain English (pseudocode). The square matrix in the center is a “representational similarity matrix“, which captures how similar each algorithm is to other algorithms in terms of their logical meanings. We compare this similarity matrix with brain responses to find where in the brain the logic of the programs is most prominently encoded.