r/programming • u/GrueneBuche • May 26 '24
MIT News 2020: To the brain, reading computer code is not the same as reading language
https://news.mit.edu/2020/brain-reading-computer-code-1215339
u/TheFeshy May 26 '24
Whenever I get burned out on programming, I go write some short stories or something similar. It's clear to my brain that these are exercising different areas of cognition.
8
u/MysticPing May 26 '24
Ive found the opposite to be true. Cant do worldbuilding or writing after programming and vise versa.
0
May 26 '24
[deleted]
166
u/TheFeshy May 26 '24
That's what I do when I'm supposed to be programming.
12
u/anengineerandacat May 26 '24
Sad truth, Reddit triggers my procrastination habits in the worst ways.
66
u/audentis May 26 '24
My own completely anecdotal $0.02: it seems like a lot of people are overloaded in their first interaction to programming. If I think back to my Master's, we had to implement some graph math in Python. There were some students who hadn't programmed before, and for them the combination of the logic they had to implement and the syntax to do the implementation with, was just too much. Struggling with syntax also meant they couldn't verify if their logic was sound. I sat down with some of them and took the syntax out of the equation (by doing it for them, by implementing the steps they described as a cooking recipe) and that went way better.
1
129
u/j____b____ May 26 '24
“MIT neuroscientists have found that reading computer code does not activate the regions of the brain that are involved in language processing. Instead, it activates a distributed network called the multiple demand network, which is also recruited for complex cognitive tasks”
157
u/Tersphinct May 26 '24
I never expected it to be processed like a language. I know we call it as such, but I don't think anyone who writes code on a regular basis ever thinks of programming languages as foreign languages. They read more like maps and flow charts than anything else, at least when formatted to most common standards.
36
u/lIIllIIlllIIllIIl May 27 '24
There is a popular idea that programming languages are hard because they're not in English; and that if you make a language that looks like English language, it'll be easy. It's called the Cobol Fallacy.
This idea is typically held by the people who think English-to-code AI tools will replace all programmers, so yeah...
3
0
May 27 '24
[deleted]
5
u/j____b____ May 27 '24
Nobody really knows but yes, AI LLMs will fail to construct sufficient architecture unless properly prompted.
1
u/red75prime May 27 '24
LLMs aren't limited to language. They learn and generalize regularities of any data thrown at them. With all the caveats of analogy you can liken them to the neocortex, not the Broca area (the region of the brain associated with speech and language processing).
96
u/markm208
May 26 '24
•
I try and ease the burden of reading code for my students with code playbacks: https://markm208.github.io
My students really like them.
Plain text code comments are a terrible medium to describe what’s happening in code. Playbacks provide some scaffolding and allow rich media to make it easier to understand the code.
1
u/bjeanes May 26 '24
This is quite cool. I’m familiar with “playbacks” for design and planning, but have never seen it applied to coding. I’m sure many engineers couldn’t be bothered with the extra work for the storytelling but I really am curious about this. Thank you for sharing!
7
u/markm208 May 26 '24
I mostly use them for teaching and they work great for that.
I started the project with the hopes of it becoming a version control system but I pivoted away from that a while back. You're probably right that most people won't want to create a code playback for every commit but if they did, it would help for code reviews and onboarding. Oh well, maybe one day.
I don't mean to self-promote but I do have a site to host code playbacks: https://playbackpress.com/books
Right now, everything is free and the tool to make playbacks is open source. Reach out to me if anyone wants to learn more.
I'm also planning on adding some AI features. Here are a couple of videos if anyone is interested:
https://youtu.be/qttYLDRvxMs
https://youtu.be/0ne0xy3A32M
15
May 26 '24
Lol. Of course it’s not the same. With code you have to remember wayyyyyyy more context and have it actively loaded into active memory while simultaneously processing what the hell the current piece you’re reading does and how it interacts with the rest of the system.
5
u/Fyren-1131 May 27 '24
I wonder how true this is for very well architected high level code using constructs like LINQ queries and other human readable language elements. At some point, code reads pretty much like a book.
4
3
3
u/lubadubdubinthetub May 26 '24
I mean yeah. It’s like a schematic for a program, it should read like a blueprint or a math equation, not a short story.
3
5
u/ahfoo May 26 '24 edited May 26 '24
I would say that it is not like reading prose rather than "language" because, in fact, mathematics is a language and programming is a practical application of mathematics.
Reading computer code is very much like reading equations which is not that different from reading difficult poetry or chemical reactions. These are all very different from prose.
2
u/CentralComputer May 26 '24
Python and ScratchJr, a visual programming language designed for children age 5 and older. The subjects in the study were all young adults proficient in the language they were being tested on. While the programmers lay in a functional magnetic resonance (fMRI) scanner, the researchers showed them snippets of code and asked them to predict what action the code would produce.
It would be interesting to repeat this with programmers who have a decade or more experience as a profession, and even better also studying the brain as they write code.
2
u/roerd May 27 '24
Duh. Reading code has always felt more similar to reading mathematical formulas than to reading natural language for me.
3
u/Linestorix May 26 '24
I was never too good at math, never too good in languages (though I speak 3 fluently), but after 40 years of programming I read and write several languages like breathing in and out, which feels great and makes me to continue programming forever.
5
u/strangedreamer May 26 '24
Same, I suck at math and suck at languages and writing. But I have been a highly skilled programmer/software engineer for almost 25 years
1
1
1
u/davidalayachew May 27 '24
Well yeah. I'm not socializing with my computer.
Funnily enough, I think a manager managing a bunch of people via spoken language are probably using the same brain muscles that programmers use to manage code.
It's all a matter of how to communicate the message so that the receiver can understand and follow through.
1
May 27 '24
Kind of an interesting thought: I think there's a translation being forgotten here.
For instance:
if (foo) bar();
In our head, we're already jumping to the logic of "if foo is true, call bar". But if we purely look at the syntax, the translation from that coding "language" translates to English as "conditional statement followed by conditional body". There's an intermediary here when we're reading that is being missed, which is:
Code->Code meaning in English->actual logic of the code.
If they focused on the Code meaning in English part I'm talking about, I'd be curious to know if the brain uses the part of the region that's generally associated with human language.
1
u/tonefart May 27 '24
Reading computer code puts me in time travel mode. At the blink of an eye, the day is gone.
1
May 27 '24
Anyone thats ever tried to read documentation could tell you that devs cant read or write in English.
1
u/chefdorry May 27 '24
Programming is a very thoughtful process, the design, planning,and execution require much more coordination than speaking. Talking is very natural and has less stress on the brain
-1
u/Simulated_Reality_ May 26 '24
I write my code so that it can be read like a story
6
1
55
u/GrueneBuche May 26 '24
Link to previous discussion and the original paper.
--- Thanks /u/syklemil for pointing it out.