Live data from Hacker News

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

news.mit.edu

161–170 of 212 posts

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

#161

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

My narrator does tell me the following:

1. Are return values identical for identical arguments?

2. Are there side effects? What are those?

3. "Congratulations, this narrator here found a story that can be told in isolation!"

4. Are the variables used in close locality to their declaration

5. Are all these loops doing what I think they do? (This one requires iterations of temporary code rewrites)

6. Is the story told with high efficiency? Can some side effects be prevented?

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

#162

> It’s not the same as language, and it’s not the same as math and logic Not the same as logic? What?? Code is literally logic itself. Code that works with all supported parameters is logically correct code by definition. It's often impossible to prove exhaustively but it can be inferred with very high confidence in many cases. Producing correct code is the goal of all good developers. Just like producing correct equ…

You missed a paragraph that would help out your understanding of what they're discussing and studying and remove the need to spam the '?' key in mock outrage: > Previous studies have shown that math and logic problems seem to rely mainly on the multiple demand regions in the left hemisphere, while tasks that involve spatial navigation activate the right hemisphere more than the left. Working with Marina Bers, a profe…

You should check the article again. My quote came directly from a quote inside the article. My critique was about that quote.

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

#163
post #152

Earlier quoted context omitted.

Reading code and not running it is like reading a Spanish text but not knowing Spanish. Running it is equivalent to comprehension.

Compilers understand code pretty well, but they don't run it. (Similarly, if you are a human translating code from C to Pascal, you'll want to understand it, but you won't necessarily execute it by hand to get that understanding.) How could you run code, when you don't know the inputs? You can reason through how the code could run with some example inputs, but that's just one of many tools we have in our belt to comp…

I’ve never seen a compiler that can answer the question: “what is the purpose of this function?” On the other hand, if I ask a human that question about a particular function and they are unable to answer it satisfactorily, I would have an extremely difficult time believing that they understand it.

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

#164

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.

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.

See https://en.wikipedia.org/wiki/Literate_programming

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

#165
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 :-)

in C there is only epic mode :)

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

#166
post #152

Earlier quoted context omitted.

Compilers understand code pretty well, but they don't run it. (Similarly, if you are a human translating code from C to Pascal, you'll want to understand it, but you won't necessarily execute it by hand to get that understanding.) How could you run code, when you don't know the inputs? You can reason through how the code could run with some example inputs, but that's just one of many tools we have in our belt to comp…

I’ve never seen a compiler that can answer the question: “what is the purpose of this function?” On the other hand, if I ask a human that question about a particular function and they are unable to answer it satisfactorily, I would have an extremely difficult time believing that they understand it.

Sure, but your human doesn't necessarily gain that sense of purpose by executing the function in their head. More likely, they are looking at the name of the function and its arguments and return values first, and work from there.

I wasn't arguing here that any existing compiler shows a human level understanding of code. Just that there are many ways to understand code, and executing in your head is but one of tools in your arsenal.

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

#167
I think there is some nuance to it.The absolutely best thing for clean code for me has been taking courses in academic writing. But also why would it activate just the language centres of the brain - especially if you are asked to predict what a piece of code would do. I think comparing to say a planning task would be more akin...

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

#168
post #160

Earlier quoted context omitted.

A language is ... does not mean ... is a language. A dog is an animal but an animal is not always a dog. I think it's clear for the both of us that PLs are not the same as languages. I would just go a little further and calling it a misnomer. For me that is a helpful framing, especially once you go into visual programming.

> A dog is an animal but an animal is not always a dog. In this sentence, "is" describes membership (a bit like isinstance in Python, or instanceof in Java or JS). In a definition, this is not the same "is". In a definition, "is" is the definitional "is", and what is after the "is" is supposed to be a comprehensive list of things you need to match to be called the term preceding the "is" (a bit like "class" or "struc…

> How is this related?

That is sort of my point, if you think of a PL as a language, visual programming is not related. You are drawing a line somewhere between PL and visual programming. If you think of a PL as a specification, it is the same thing just presented differently.

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

#169
I mostly work at home, and when I'm coding, I generally have music on. I like to sing along with music, and I sit at my desk singing and coding all day long.

But I could never do this if I was reading something. It's impossible to read something and sing something else at the same time. But it's perfectly easy to do while coding.

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

#170
post #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.

My worst grade in school was German. Then, after graduating and when working my third programming job, I've started learning it again and I realized I'm actually really good at human languages (learning words and reading came naturally to me). It's just a school environment which stopped me.
Post reply on HN