Live data from Hacker News

To the brain, reading computer code is not the same as reading language (2020)

news.mit.edu

121–130 of 212 posts

Re: To the brain, reading computer code is not the same as reading language (2020)

#121
post #61

Might not be the same, but reading computer code and Ancient Greek or Latin are remarkably similar skills. I could be convinced that parsing a language at that resolution isn’t how language processing works for general use, but that’s like saying diagraming a sentence isn’t speaking a language. Technically true but missing the point.

Agree, something i noticed also, is that people who make PLs, like Guido van Rossum (Python), Rich Hickey (Clojure), Guy Steele (Common Lisp), Stroustrup (C++) and many others, they use natural language expertly.

They express their thoughts in a simple way yet accurate, they are not getting confused, they do not use a million "you know" and "like" hand waiving and getting lost in the weeds.

Stating that PLs are not absolutely the same as natural languages is true, but no association at all? Or very little association? Difficult to believe.

Re: To the brain, reading computer code is not the same as reading language (2020)

#122
post #31

Earlier quoted context omitted.

And this is why getting interrupted is so annoying It takes a while to “load up” all of those things in our minds, and it’s a bit like a balancing act, you need to keep balancing them to prevent the whole thing from crashing down Then if you get interrupted, it is like loosing balance and things falling into a mess. Afterwards you need to sort of pick everything up again, which takes time and effort More than a coupl…

I had this a lot in my 20s, but I notice in my 30s that an interrupt won't derail me as much. It's not that my brain is better at caching states, I think it's to do with being a better coder: meaningful comments, better proficiency in using the IDE, knowing when to not implement something from scratch,

There's a fairly simple explanation for this. We've seen in studies that experts aren't fundamentally any better at remembering things. We just get better at chunking more and more abstract groups of information together. We can never increase the around 7 pieces of information we can hold in short-term memory. But we can increase what and how much those 7 pieces represent.

Re: To the brain, reading computer code is not the same as reading language (2020)

#123

"Language" in the context of PL is a misnomer. People even scientist seem to fall into that trap (remember the literate programming movement). PL's are better described as "Specifications". More similar to file format specifications, later converted to executables or interpreted. > the researchers showed them snippets of code and asked them to predict what action the code would produce. That is only (a small) part of…

You are correct, it's more properly thought of as a specification. However it's a bit more than a misnomer, it's a kind of religion or cult with roots going back decades.

There will be a comeback of literate programming. Tools were not advanced enough for it to be really practical. CS was not mature enough as a field for LP to flourish.

Re: To the brain, reading computer code is not the same as reading language (2020)

#124
Fascinating. As someone who has written (and read) a lot of code and written (and read) a lot of legal language, and as someone who has consistently recommended that young people learn programming principles before going to law school, I'd be very curious to see if reading a complex contract prompted the same response.

I always heard that "you'll never read for pleasure again" after law school, but, if anything, I read for pleasure more now than I ever did, and my work "reading" feels like something completely removed from it.

Re: To the brain, reading computer code is not the same as reading language (2020)

#125

You can tell because code has no narrator voice in your head when you read it.

Fun fact, when comprehending sign language the narrator voice is the same as when comprehending vocal language. By the same I mean that it works and "sounds" the same, but obviously it has the grammar and vocabulary of whatever sign language you're communicating in. The exact same parts of the brain are at work, too.

I think this implies that the narrator voice isn't really a "sound echo" but rather your comprehension at work. Just like when reading text.

Re: To the brain, reading computer code is not the same as reading language (2020)

#126

The paper wasn't linked as far as I can tell but is probably https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7738192/pdf/eli... > 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 I have a suspicion that writing code and understanding that written by someone else are different skill sets.

Perhaps reading code activates the same arras as reading prose in English, but running code in your head activates other areas

Re: To the brain, reading computer code is not the same as reading language (2020)

#127

Earlier quoted context omitted.

That’s an excellent point. I’ve realized that I sometimes read code in more of a “story” mode, where I’m just looking for the gist of what’s happening and what it is “about” rather than the nuts and bolts of how it actually works.

“Story” mode is why I like to organize my code top-down, often with definitions appearing after their usages. It makes the code read more like a story from top to bottom. Some like to organize their code such that any term always appears before it is used. Like a math proof or something. I find this somewhat pleasing but unhelpful for understanding the “story” you mention.

That’s so interesting. I find myself organizing code to have minimum-understandable units, which ends up following the narrowing project->folder->file… abstraction all the way down - the end product resembles more a taxonomy than a story. I love your metaphor though and I am going to try it right away.

Re: To the brain, reading computer code is not the same as reading language (2020)

#128

A really interesting finding considering how many comparisons of code to literature exist. I.e. the advice of laying your files out like a “newspaper”, writing your code in logical evolutions like an essay, etc…

I've never heard that advice about newspapers? Maybe you're thinking of literate programming. Anyway I don't think it's a remotely interesting finding. Anyone that has done any programming knows that it is not like natural language. We even explicitly know that from the complete failure of languages that try to be programming languages and natural languages like AppleTalk. The fact that you use English words in your…

I’m not thinking of literate programming, no. I’m familiar with that. I’m referring to a fairly well-known recommendation from Clean Code.

https://www.baeldung.com/cs/clean-code-formatting#vertical-f...

I don’t agree that “anyone who has done any programming” knows it’s not the same. The number of comments to the contrary in this thread is evidence enough. The parallels between natural and programmatic languages are not just undeniable but often useful, and how the human brain models its understanding of code is orthogonal to that utility.

Re: To the brain, reading computer code is not the same as reading language (2020)

#129
post #75

Earlier quoted context omitted.

> I think the similarity between human languages and computer code is frequently overstated It wouldn't even occur to me to think of them as belonging to the same category.

Occasionally you come across languages that do and, at least to me, those languages feel extremely difficult to deal with. For instance, I found AppleScript and HyperTalk to be awful to work with. I also notice that some junior programmers I've worked with tend to argue for coding styles in mainstream languages that read almost like sentences. Not sure if this is a generational thing or an experience thing.

What's old is new again - see SQL and COBOL. They certainly are easy to get the gist of from the words even if you don't know the language. (The business logic may be spaghetti in a COBOL program, but what's happening is clear.) I like it, and I remember SQL easier after disuse than the syntax of something else I've used equally sparsely like bash scripting.

Then on the opposite end of the spectrum wrt new things, we have Rust, which comes off to me as pathologically terse and inscrutable - certainly much more difficult for a newbie to parse than SQL.

Re: To the brain, reading computer code is not the same as reading language (2020)

#130

I run a YouTube channel that's mostly devoted to reading code: https://www.youtube.com/@ants_are_everywhere I (try to) read code from popular open source projects. It's a bit like sight reading in music because the idea is that I go in blind and try to make sense of it. This rings true to me: > The researchers saw little to no response to code in the language regions of the brain. Instead, they found that the coding…

> It's a bit like sight reading in music I was wondering if there was any correlation in the ability to sight read music and to quickly understand code. I played a few musical instruments as a child and teen but never got good at sight-reading. I've heard that musical ability and programming ability are often correlated but I could never have made it as a working musician. I did make a good career out of programming…

I've been curious about this too. I do play music. I've played maybe about 6 different instruments live in bands. But I was never any good at sight reading.

My guess is if I were to try it now I'd be a lot better at it than I used to be.

I do, however, rather consciously think of it as a form of improvisation. And I am much better at improvisation than I was at sight reading.

Post reply on HN