Live data from Hacker News

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

news.mit.edu

101–110 of 212 posts

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

#101

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.

Both programs and math proofs are allowed to be written in story mode where definitions can come after their usages. Unless you write in C. There's no story mode in C :-)

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

#102

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.

That would already support the thesis, because formulating and understanding natural language share quite a bit.

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

#103

Not surprising at all, reading code is not like reading prose, not even doing math, is more like a puzzle building in the brain. There's a myriad things to mentally connect and substitute/translate in realtime in order to understand what the code is doing: each function, symbol, variable, statement, abstractions all the way down that makes reading code even more complex than writing it in the first place.

It looks different and has a very different syntax and meaning. Practically yhe only thing it has in common is that it's also called "a language."

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

#104
post #101

Earlier quoted context omitted.

“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.

Both programs and math proofs are allowed to be written in story mode where definitions can come after their usages. Unless you write in C. There's no story mode in C :-)

There is CWEB. Literate programming is the ultimate story mode.

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

#105
Alright, since I did a quick skim over the article liked by @JonChesterfield and didn't find any discussion of how they calibrated their fMRI machine or if they did any Multiple Comparison Corrections, time to post the obvious: http://prefrontal.org/files/posters/Bennett-Salmon-2009.pdf

fMRI is not a silver bullet, do your due diligence everyone. I'll wait for this to be replicated before I read anything into it.

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

#106
post #95
post #75

Earlier quoted context omitted.

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.

I’ve seen the same thing, it might be generational. Someone arguing that we need an isNotEqual(a, b) helper in addition to isEqual(a, b), because that’s supposedly “cleaner” and more readable than !isEqual(a, b). They were very vehement about it, but I don’t get that at any level. It’s more lines of code to write and maintain, more unit tests, more characters to type at the usage site and to me, reads exactly the sam…

For me, reading isNotEqual() introduces an extra mental variable. I have to spend extra effort to keep track of the bar over the statement that doesn't exist in the text.

But that said, I see no reason that someone couldn't learn to parse notX as fluently as I parse !X. I suppose it's one of those fashions that change with the times. Probably a big reason that I stick to good old C a lot of the time.

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

#107
post #70

Lex Fridman recently interviewed Edward Gibson, a linguist, and they talked a lot about how the brain processes language, including how someone reading code lights up a completely different part of the brain than language. #426 https://lexfridman.com/podcast/ ETA: I believe Evelina Fedorenko, from this paper, is Edward's wife.

I believe it. My worst grade in primary school was french and I'm having such a hard time learning Chinese compared to my peers (taking evening online classes in community college) but programming has always come naturally to me. Completely different skillsets as far as I'm concerned.

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

#108
post #53

I'm more surprised that anyone with any experience in programming languages has actually thought this could be the case. Making programming languages superficially more like human languages is one of the classic rookie mistakes of programming language design. (See Perl's "do what I mean" paradigm and the chaos that resulted from it) I think two important differences right there are that programming languages are more…

I'm approaching 30 years of experience and I do read code like human language. The visualizations I'm using for data structures aren't really much different than visualizing a scene from a book.

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

#109
post #70

Lex Fridman recently interviewed Edward Gibson, a linguist, and they talked a lot about how the brain processes language, including how someone reading code lights up a completely different part of the brain than language. #426 https://lexfridman.com/podcast/ ETA: I believe Evelina Fedorenko, from this paper, is Edward's wife.

[link]https://youtu.be/F3Jd9GI6XqE?t=4847 to relevant section

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

#110
post #71

I was just thinking today about an idea to introduce some programming constructs to legal documents like contracts and organization policies/procedures. The specific situational semantics inside the documents would still be natural language and meant for human decision makers to implement, but the control flow aspects would be rigidly formalized well enough that documents conforming to this standard could be automati…

> I was just thinking today about an idea to introduce some programming constructs to legal documents like contracts and organization policies/procedures.

In my late teens I saw a contract my dad had brought home, and that one at least already had some basic constructs - I saw analogues to variables, logic/conditionals (as used in a programming language rather than natural language), and possibly even subroutines.

And that's just what I remember, it wouldn't surprise me if there were already more such commonalities. It would certainly explain why legal documents are so difficult for the layperson.

Post reply on HN