[HN Gopher] To the brain, reading computer code is not the same ...
       ___________________________________________________________________
        
       To the brain, reading computer code is not the same as reading
       language (2020)
        
       Author : thunderbong
       Score  : 118 points
       Date   : 2024-05-26 09:54 UTC (13 hours ago)
        
 (HTM) web link (news.mit.edu)
 (TXT) w3m dump (news.mit.edu)
        
       | yamrzou wrote:
       | Better replace the submission with the linked article at the end:
       | https://news.mit.edu/2020/brain-reading-computer-code-1215
        
         | ooterness wrote:
         | Related discussion here:
         | https://news.ycombinator.com/item?id=40481536
        
           | dang wrote:
           | We'll merge that one hither. Thanks!
        
         | dang wrote:
         | Thanks--we changed the URL above from
         | https://learnhub.top/understanding-how-the-brain-reads-
         | code-....
         | 
         | Submitters: " _Please submit the original source. If a post
         | reports on something found on another site, submit the latter._
         | " - https://news.ycombinator.com/newsguidelines.html
        
       | danybittel wrote:
       | "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 programming (the simulating in
       | your head). I'd argue that biggest part of programming is
       | organizing and communication.
        
         | jraph wrote:
         | I disagree.
         | 
         | Wikipedia's definition [1] is what I had in mind for language:
         | 
         | > Language is a structured system of communication that
         | consists of grammar and vocabulary
         | 
         | Programming languages are structured, have grammars (often
         | described formally using a grammar definition for some parser
         | generator) and vocabulary (the set of functions and types you
         | can use, possibly modules and package, basically), and they are
         | used to communicate (with the machines, and with fellow
         | developers).
         | 
         | The "file format specification" would be a (subset of) the
         | specification of the language, not the language itself, and
         | yes, a file format specification can describe a language (but I
         | believe we only say this for stuff intended to be read and
         | written by a human - so ZIP would not be a language, but HTML
         | would be).
         | 
         | I do agree that programming languages and human languages are
         | not the same thing, they have different characteristics,
         | traits, use cases, behavior... and that's why this study
         | compares them. And that's also why we need to make the
         | distinction. And they also have common stuff, hence the same
         | word. But even if you disagree that they have a relevant amount
         | of common stuff, polysemy is a thing, so it's still "fine" to
         | call English a language and C a language. Quotes around fine
         | because I'm actually only describing what happens: we do call
         | them both "language", that's a fact.
         | 
         | > I'd argue that biggest part of programming is
         | 
         | It might be, but the paper studies and focuses on programming
         | _languages_ , not the more general practice of programming
         | (which is worth studying, but studies always have a
         | (restricted) scope).
         | 
         | > remember the literate programming movement
         | 
         | Where's the confusion in / what's wrong this? Some think that
         | it's better to narrate in code and we call that literate
         | programming. I don't share the vision, but everything looks
         | clear to me.
         | 
         | [1] https://en.wikipedia.org/wiki/Language
        
           | danybittel wrote:
           | Who are you "communicating" with? A programmer does not
           | communicate with a computer, through a PL. He or she writes
           | it down, to later be executed or interpreted, so the
           | _computer_ can  "communicate" with the user, through the User
           | interface (not the PL).
           | 
           | Also, the vocabulary works very different, in a PL almost all
           | of the vocabulary is defined "at hoc", as you go.
           | 
           | I mean I don't have a problem calling them a language, people
           | should just be vary not to use language ideas for PL.
        
             | jraph wrote:
             | > Who are you "communicating" with?
             | 
             | I wrote this: "with the machines, and with fellow
             | developers"
             | 
             | > A programmer does not communicate with a computer,
             | through a PL
             | 
             | I disagree with this. The programmer describes the steps
             | that the computer needs to perform, to the computer. Or the
             | programmer describes the state which the computer should
             | reach.
             | 
             | The communication is one way (except, arguably, during
             | debugging sessions), but a communication does not need to
             | be two ways.
             | 
             | > He or she writes it down, to later be executed or
             | interpreted, so the computer can "communicate" with the
             | user, through the User interface (not the PL).
             | 
             | You seem to set yourself in the end user perspective, but
             | the developer is also a human, and I'm in the developer's
             | perspective here.
             | 
             | > people should just be vary not to use language ideas for
             | PL.
             | 
             | Agreed, some / many ideas applying to natural languages
             | don't apply to programming languages. But some do.
             | 
             | > the vocabulary works very different
             | 
             | Absolutely. There _are_ strong differences.
             | 
             | (of course, it's fine we don't agree, we are arguing on
             | definitions)
        
               | danybittel wrote:
               | Even if you consider it communication, that doesn't make
               | it a language. Plenty if communication happens through
               | other means.
               | 
               | If we look at the debug session or bash scripting, the
               | closest thing of a two way communication. It doesn't
               | "answer" in code.
               | 
               | I see code closer to something like a Floor Plan an
               | architect may use or a CAD drawing from an engineer. Both
               | of them also communicate, but they are not considered
               | languages. They also have a rules (grammer?) and patterns
               | (vocabulary?).
        
               | jraph wrote:
               | > Even if you consider it communication, that doesn't
               | make it a language
               | 
               | In my first comment, I have broken down the definition of
               | language I found and (supposedly) successfully applied
               | each part of it to programming languages (communication
               | being only one of the features).
               | 
               | Where is my mistake?
               | 
               | Either the definition is wrong, or incomplete, or one of
               | the matches I made is erroneous, or I missed a match.
               | 
               | > an architect may use or a CAD drawing from an engineer.
               | Both of them also communicate, but they are not
               | considered languages. They also have a rules (grammer?)
               | and patterns (vocabulary?).
               | 
               | Tough one, maybe those drawings _are_ indeed expressed in
               | a language, just that we don 't usually see it as a
               | language / think of it like this. That would apply to map
               | symbols as well [1].
               | 
               | edit: Just noticed French Wikipedia [2] actually cites
               | cartography as a language without a syntax, so that would
               | check out:
               | 
               | > la cartographie est un exemple de langage non
               | syntaxique
               | 
               | ("Cartography is an example of non-syntactical language")
               | 
               | French Wikipedia broadly has the same definition for
               | language as English Wikipedia, but makes the grammar part
               | optional.
               | 
               | We could argue that the examples you cited are indeed not
               | languages using the English definition because they don't
               | have grammar (if rules you mentions are not grammar - and
               | indeed you would probably not need a pass of syntactical
               | analysis to "parse" a CAD drawing)
               | 
               | [1] https://en.wikipedia.org/wiki/Map_symbol
               | 
               | [2] https://fr.wikipedia.org/wiki/Langage
        
             | HankB99 wrote:
             | > people should just be vary not to use language ideas for
             | PL.
             | 
             | (s/vary/wary/, I suspect.)
             | 
             | Why not? I thought of crafting a system as telling a story
             | about what the system was going to do, whether or not it
             | involved an interaction with users. The syntax and
             | structure is extremely precise compared to literature, but
             | if it doesn't tell the story clearly, it's less likely to
             | be a successful effort, both in use and for maintainers.
        
             | BurningFrog wrote:
             | To me, the biggest dividing line between mediocre and good
             | programmers is who they write code for.
             | 
             | The mediocre ones write their code for the
             | computer/compiler/interpreter. When it works, they're done.
             | 
             | The good ones write their code for human readers to
             | understand, including their future self.
        
           | canjobear wrote:
           | It's more than a coincidental resemblance. Programming
           | languages were designed using constructs from linguistics
           | (context-free grammars, parsers) that were originally
           | developed to describe natural languages.
        
         | carschno wrote:
         | I suppose the term language in the context of computing is
         | widely accepted because it shares many properties with human
         | language. Hence the common taxonomy in which both natural
         | (human) languages and formal (programming) languages are
         | different types of languages.
        
         | iceburgcrm wrote:
         | I find removing the organizing and communication layers greater
         | increases your velocity. For each idea we need to communicate
         | to others or ourselves (in a linear language) involves a
         | translating process. Removing the need for that layer leaves
         | you in the coding zone. Once you have to leave for translating
         | it becomes an expensive process for your brain to recreate the
         | verbal / non verbal environments (or takes too much energy to
         | hold both plus the translation path).
         | 
         | I have a theory that burnout is more common when you keep
         | shifting mental states. Developers who have a phone that keeps
         | ringing throughout the day (or slack messages or urgent emails)
         | are burned out at the end of the day more often than those
         | allowed to be in one state.
        
           | electrondood wrote:
           | I'm working in a library that was written by someone who no
           | longer works at the company who thought this way.
           | 
           | It's an absolute nightmare to understand. He may have been in
           | the "coding zone," but he chose variable names that make no
           | sense, abstractions that don't map on to any actual entities,
           | and left no coherent documentation.
           | 
           | I think the organization and communication layers are
           | absolutely critical, and any apparent velocity tradeoff is
           | just accumulating technical debt, because there's probably an
           | entire team who is perpetually on the hook for supporting
           | what you wrote, and actual long-term velocity over time
           | depends on their ability to understand it.
        
             | iceburgcrm wrote:
             | I think communication layers are critical as well. On a
             | team they are more important than the coding and that's why
             | you hire someone to lead and organize everything.
             | 
             | Removing the large team removes those layers and it's why a
             | two person team can do the work of 12.
             | 
             | Adding in documentation, training materials and providing
             | support can happen at the end of the development cycle
             | freeing you to support the project 100%.
             | 
             | It's not that you remove communication or documentation but
             | do it at select intervals. Don't do a full scan of a table
             | everytime you need a value found in the index.
        
         | wellbehaved wrote:
         | 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.
        
         | samatman wrote:
         | Programming languages have a syntax, a semantics, and a more or
         | less formal grammar. They have an alphabet, and morphemes in
         | the form of tokens.
         | 
         | They're a notation, yes, but one with a precisely linguistic
         | form. Language is an appropriate word to use here.
        
         | Talinx wrote:
         | I agree - I think it is pretty clear that there is a difference
         | between programming languages and other languages. Figuring out
         | the differences (instead of getting wrong ideas because they
         | share some similarities) should lead to better words for
         | different kinds of languages.
         | 
         | Maybe "Spoken languages" is a better term for languages like
         | English? I find speaking computer code out loud just doesn't
         | work except for some particular lines of code. "At dataclass
         | class QueueItem magnitude colon int equals one..." is really
         | not clear, if I have to communicate such code in words I
         | wouldn't read it directly and instead describe it, e. g.
         | "QueueItem is a dataclass with the attributes...").
        
         | HarHarVeryFunny wrote:
         | Yes, obviously there is some conceptual similarity to written
         | language, but the goals are really quite different. Human
         | language is used to communicate, which involves theory of mind
         | and modelling the listener. Programming language is just
         | specifying a computation to be performed.
         | 
         | Still, it's interesting to consider why the "language areas" of
         | the brain apparently are not used for reading or writing
         | computer language (or for other different types of mental
         | activity for that matter).
         | 
         | Some processing areas of the brain are obviously dictated by
         | connectivity and adjacency (visual pathway connects to visual
         | cortex, auditory pathways connect to auditory cortex), but
         | reading of both prose and computer code comes in visually, so
         | why does one get processed by Wernicke's area, and one not?!
         | The best I can guess is that multiple areas of association
         | cortex might be competing to recognize/predict visual inputs,
         | and those areas best equipped to do so will win and perhaps
         | suppress the others.
         | 
         | If this suggestion is true - that via competition the best
         | suited area of brain gets used, then it begs the question what
         | are the key differences, pertinent to the brain, between
         | written prose and computer code that cause this differentiated
         | processing?
        
           | HarHarVeryFunny wrote:
           | I tried asking both Claude Sonnet and GPT-4 (Bing CoPilot)
           | about this, and they referred to the brain using "selective
           | activation" to only enable language areas for language
           | inputs, but both talked in circles and couldn't explain how
           | this "selective activation" actually works - how does the
           | brain (starting from nothing - no knowledge of written
           | language) start to selectively activate Wernicke's area only
           | for language? Its more understandable how processing gets
           | consolidated there, and suppressed elsewhere, once it gets
           | started!
        
       | JonChesterfield wrote:
       | 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.
        
         | fmbb wrote:
         | I feel like this is akin to asking someone to read a fairytale
         | and to tell you how many times a person crossed a bridge in it,
         | or what they carry in their hand in the end, or where the apple
         | is when all is done.
         | 
         | I don't think this is about understand what is written, it's
         | about figuring out what that which is written means.
        
           | wanderingstan wrote:
           | 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.
        
             | bigyikes wrote:
             | "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.
        
               | rav wrote:
               | 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
               | :-)
        
               | Bootvis wrote:
               | There is CWEB. Literate programming is the ultimate story
               | mode.
        
               | NavinF wrote:
               | wtf is CWEB? I presume you're referring to something
               | other than "China Internet Index Bull 2X ETF"?
        
               | gshubert17 wrote:
               | See: http://literateprogramming.com/cweb_download.html
        
         | layer8 wrote:
         | Different, but not entirely different, both use the same kind
         | of reasoning about program behavior. And the article is not
         | about writing code, other than to the extent that it should be
         | comprehensible by others.
        
         | tgv wrote:
         | That would already support the thesis, because formulating and
         | understanding natural language share quite a bit.
        
       | fredgrott wrote:
       | from my own exp of rebuilding my mind map after getting control
       | of my adhd through nootropics it seems to be writing and
       | explaining it to someone else forces my brain to fine tune the
       | meta-language mind map of coding it has.
        
         | jraph wrote:
         | > rebuilding my mind map
         | 
         | and
         | 
         | > to fine tune the meta-language mind map of coding it has
         | 
         | I have difficulties to understand / unpack these parts of your
         | sentence, what do you mean?
        
       | codeflo wrote:
       | From the linked article, they found that it activates the region
       | of the brain that carefully reasons through unfamiliar problems.
       | They also speculate that this might not generalize to people with
       | 30 years of programming experience. Well, fine, a lot of academic
       | research is done with students. But doesn't that invalidate any
       | comparisons with natural language processing, something that the
       | test subjects do have decades of experience in?
        
         | jraph wrote:
         | What I understand from this is that it could be that with 30
         | years of programming experience, the region of the brain that
         | carefully reasons through unfamiliar problems activates less.
         | 
         | That would make sense: if you are unfamiliar with programming,
         | it makes sense that the unfamiliar problems zone activates.
         | 
         | It would be interesting to study this, to know if this zone
         | activates because of the unfamiliarity or if it still activates
         | with experience while dealing with code.
         | 
         | It could be that the zone will activate regardless (i.e.
         | because when you are reading code, you are somehow always
         | dealing with unfamiliar stuff - because this is _why_ you are
         | reading code in the first place usually) or not (i.e. because
         | reading code is now familiar).
         | 
         | > But doesn't that invalidate any comparisons with natural
         | language processing, something that the test subjects do have
         | decades of experience in?
         | 
         | It could: the test subjects would probably need experience in
         | both natural language processing (which they have) and
         | programming for the comparison to be fair. We most likely won't
         | have "as familiar in both stuff", so we'll most certainly have
         | to just do with "familiar enough with code".
        
           | abcde777666 wrote:
           | Anecdotally, looking at code written by someone else always
           | goes to 'unfamiliar' territory. I can only read code I'm very
           | familiar with like a book.
        
             | 8372049 wrote:
             | Equally anecdotally, I mostly agree but have a friend who
             | writes code much like I do. Reading his code is like
             | reading my own.
        
         | BuyMyBitcoins wrote:
         | I would be very curious to see what happens when the subjects
         | are looking at a codebase they are familiar with. Even if there
         | is some code within the repo they haven't seen yet, the
         | familiarity from style, convention, and knowing how the code
         | fits into the rest of the program as a whole probably has a
         | large impact as to how it is perceived.
        
         | rvense wrote:
         | Maybe compare to second year students of a very foreign
         | language...
         | 
         | (Though I have to say, I'm a self-taught programmer with an
         | academic background in theoretical linguistics as well as
         | university-level experience of several languages quite
         | different to my first language, and this result doesn't not
         | surprise me. There are some obviously analogies to be made at
         | some levels, I think the similarity between human languages and
         | computer code is frequently overstated and a remnant from a
         | more primitive linguistics that was quite narrowly focused on
         | grammar.)
        
           | thaumasiotes wrote:
           | > 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.
        
             | bborud wrote:
             | 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.
        
               | codeflo wrote:
               | 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 same way.
        
               | utensil4778 wrote:
               | 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.
        
               | 8372049 wrote:
               | My personal opinion is that 'not' (Python-style) should
               | be the operator instead, simply because it's easier to
               | miss a ! than a 'not'. With that said, I'm with you in
               | the 'not isEqual(a, b)' camp.
               | 
               | The exception, imo, is functions that take boolean
               | arguments. Languages should make it easy to show what
               | they mean, and devs should take care to explain them.
               | 
               | sort(reverse=true, numeric=false) is much easier to read
               | than sort(true, false).
               | 
               | (Silly example, it's meant to illustrate the general
               | point, not to say anything about the signature of a
               | sort() function.)
        
       | upmind wrote:
       | People have always told me the best programmers/computer
       | scientists are also great mathematicians and this seems to
       | support that. Esp thinking about Turing, Von Neumann and Knuth
        
         | mrbungie wrote:
         | Academic/theorical computer scientists, totally.
         | 
         | But pragmatic programmers / software engineers, try reading the
         | average PhD's python code. Usually it is a mess.
         | 
         | Knuth may be an exception, rather than the rule.
        
           | Kinrany wrote:
           | Average PhDs are by definition not the best though?
        
       | blueflow wrote:
       | You can tell because code has no narrator voice in your head when
       | you read it.
        
         | chownie wrote:
         | Narrator voice doesn't kick in for me until a character speaks,
         | narration is voiceless.
        
         | tstrimple wrote:
         | That must be nice. My internal dialog never shuts the fuck up.
        
           | laurowyn wrote:
           | I would say `narrator voice` in this context is distinctly
           | different from internal dialogue. Obviously the internal
           | voice can narrate to yourself, but that voice tends to be
           | slightly different in my experience.
           | 
           | Narrator voice is a specific voice, cadence, pattern etc.
           | that your internal voice takes on when reading a narrative,
           | rather than the narration of your experience. For me, I have
           | a different voice when reading/writing technical
           | documentation compared to reading/writing fictional works,
           | which both are different from my day to day internal
           | dialogue.
        
           | vinceguidry wrote:
           | These folks have a proven track record in shutting that thing
           | up if it's worth $500 to you.
           | 
           | https://45daystoawakening.com/landing-page1594666682471
        
         | codesnik wrote:
         | well, people are different. I feel like I have narrator voice
         | for the code, not exactly the same way books do, but still
         | something similar.
         | 
         | Also when I'm trying to read code I feel distracted and annoyed
         | by any background noise where I can recognize words, like
         | speech or music in a familiar language. And I can't talk while
         | coding, it messes up what I'm typing. Also I really prefer
         | english-like languages, like ruby, to more sigil or symbol
         | loaded, like rust, or full of abbreviations and operators, like
         | Haskell. But I'm sure other developers have other brain
         | pathways activated.
        
           | mccrory wrote:
           | That could be signs of something else too.
        
         | rPlayer6554 wrote:
         | I do have a narrator in my head although it's usually a summary
         | or description of Whats going on. Not a literal word for word
         | read. I also have visualizations.
        
         | nkozyra wrote:
         | Agree with sibling comments I'm almost always hearing a voice
         | describing what I'm looking at, trying to pull the whole thing
         | together.
        
         | laurowyn wrote:
         | I have a narrator voice when reading code. It's the same
         | narrator voice as when reading technical reports and white
         | papers. I do sometimes struggle to process code that doesn't
         | read well, likely because the cadence of the narrator voice
         | gets disturbed and doesn't flow well.
         | 
         | I've found that my descriptions and explanations of how things
         | work generally follow the same cadence as this narrator voice,
         | which tends to help me explain things succinctly and transfer
         | knowledge quickly.
         | 
         | I do agree it's distinctly different from the narrator voice
         | for fiction books. I would assume that's due to the
         | presence/lack of emotive language between the two types of
         | writing.
         | 
         | Perhaps this is a similar phenomenon to the inner monologue
         | that some people have but others don't? Or the ability to
         | imagine various levels of detail of objects without physically
         | seeing them? The mind is a strange beast.
        
           | hinkley wrote:
           | Mine consists primarily of swear words.
        
       | crazygringo wrote:
       | This definitely feels intuitively correct, at least for how my
       | brain works.
       | 
       | When I'm reading language (prose), so much is happening -- what
       | is the writer's overarching point and how does this fit in,
       | parsing tons of ambiguity (a word can have lots of meanings),
       | picking up on the writer's "style" (short and to the point?
       | verbose and flowery?), sometimes enjoying the rhythm and even
       | "musicality" of a sentence, visually imagining a "picture" if
       | it's literature, and so forth.
       | 
       | When I'm reading code, it feels much more like following Lego set
       | instructions, or a math proof. And I'm going slowly. It
       | absolutely feels like I'm using a completely different part of my
       | brain from when I'm reading.
       | 
       | Yes there's a little bit of overlap -- variables can use long
       | descriptive names, and I might be reading a non-fiction article
       | about economics that uses some of they math-y concept-building I
       | use in reading code. But that's about it.
       | 
       | Technically both have a "grammar", but they written language
       | grammar has a flexibility and artistry and ambiguity about it,
       | while computer grammar is rigid and logical and unyielding.
       | Interpreting them feels like they use very different parts of the
       | brain indeed.
        
       | apantel wrote:
       | I can tell this is true because every now and then with enough
       | syntactic sugar I write code that CAN be read almost like
       | language, and reading it that way takes a shift of mind that
       | feels weird. It's like putting on a different set of goggles.
        
         | gilleain wrote:
         | Yeah I feel like this is why fluent APIs sometimes irritate me.
         | Like they can be clever, and can be natural:
         | 
         | do(thisThing).and(thisOtherThing).until(someStopcondition)....
         | 
         | but when this breaks down it becomes quite ugly.
        
       | ants_everywhere wrote:
       | 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 task mainly activated the so-called multiple demand
       | network. This network, whose activity is spread throughout the
       | frontal and parietal lobes of the brain, is typically recruited
       | for tasks that require holding many pieces of information in mind
       | at once, and is responsible for our ability to perform a wide
       | variety of mental tasks.
       | 
       | There is language of course, but I'm not working hard to process
       | the language so it wouldn't show up as an fMRI signal. I am often
       | holding several things in mind at once, including things like
       | what the code does, what the authors are trying to do, what the
       | author's background might be, how similar software works etc.
       | 
       | I did study math, and it also doesn't really feel like reading or
       | doing math.
        
         | inciampati wrote:
         | To me reading code is reading math. It feels exactly the same.
         | Same pattern about holding lots of things in mind at once.
        
           | nkozyra wrote:
           | Most code is interpreted as declarative regardless of how
           | it's written. I've always interpreted a chunk of
           | functionality as a block of logic. Which is why syntax
           | structures like if/else feel do natural. But we don't really
           | follow natural language the same way.
        
           | jack_riminton wrote:
           | What coding language/s do you normally use and what things
           | are you most often coding?
        
           | cgriswald wrote:
           | Likewise. Both code and math are almost physical objects in
           | my mind. I hold these objects and relationships between them
           | in my mind.
           | 
           | I find it interesting that for language I find reading easier
           | than writing but for code or math it is the opposite. When
           | reading code or math it almost feels the same as when I'm
           | learning a foreign language and trying to read it. I have to
           | "translate" it into the my internal "objects".
        
         | nico wrote:
         | 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 couple of those in a row are incredibly frustrating
         | 
         | Pg talks about this in his essay of the maker schedule vs the
         | manager schedule: (2009)
         | https://paulgraham.com/makersschedule.html
        
           | tetris11 wrote:
           | 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,
        
             | recursive wrote:
             | If you're lucky enough to be working on your own code, that
             | can work.
        
             | kinos wrote:
             | Taking notes, taking notes, taking notes. Notepad as an
             | external memory is just an amazing game changer for this.
             | Doesn't even need to be deep, just a running tally of what
             | you're thinking to get it to somewhere that you can
             | reference it instead of running it on a loop in your short
             | term memory. Makes fading in and out of it so much easier.
             | I treat it like a conversation with myself half the time
             | and the other half the time like I'm writing a reference
             | book for someone else. Its worked well for fresh code, code
             | to be, and analyzing existing code made by someone else.
             | Cannot recommend it enough.
        
         | spacetimeuser5 wrote:
         | >>This network, whose activity is spread throughout the frontal
         | and parietal lobes of the brain,
         | 
         | A (rare enough) person in chronic coma, regaining consciousness
         | on a sedative-hypnotic drug zolpidem, which lasts for a couple
         | of hours as long as the drug is active, can also show parietal
         | lobes (and a bit of dorsal frontal lobes) activation (as
         | showcased probably in Hamilton's Pharmacopoeia in a series on
         | zolpidem).
         | 
         | Thus, according to modern neuroscience and brain imaging,
         | reading code is basically the same as regaining consciousness
         | on zolpidem while in coma.
        
           | ants_everywhere wrote:
           | This is pretty fascinating, thanks!
        
         | SoftTalker wrote:
         | > 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 though.
        
       | theodric wrote:
       | At the risk of just being flippant, _duh_. Language is a means
       | for expressing thoughts, feelings, emotions, and data. Code is a
       | means for instructing a machine how to behave. One encapsulates
       | as much of the experience of being a human as we 've been able to
       | cram into it, and the other is a shopping list. They are not the
       | same.
        
         | Kim_Bruning wrote:
         | There's quite some things that seem to only/best be expressed
         | as code or mathematical formulas, rather than as natural
         | language. (things like cellular automata come to mind)
        
       | mercurialsolo wrote:
       | We have come to see with LLM's that language can be generated by
       | using math.
       | 
       | Would love to see if this is the same when reading different
       | patterns of code - functional vs object oriented. Where do
       | product specs or technical specs lie?
       | 
       | All of this feels more pseudo-science to me - the distinction
       | between language and math is not well understood at the moment.
        
       | jack_riminton wrote:
       | I wonder if some coding languages are more akin to 'normal'
       | languages than others. I found it interesting that the scratchJS
       | activated more of the brain associated with spatial tasks which
       | makes sense as I believe scratch is most often used for computer
       | game-type apps?
        
       | distortionfield wrote:
       | 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...
        
         | IshKebab wrote:
         | 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 identifiers and
         | comments in your code doesn't make it English any more than
         | writing a paper about maths and using `m` for mass means maths
         | is linguistic.
        
       | Ericson2314 wrote:
       | Does anyone actually read code in textual order? I am much more
       | often reading vertically, like a shallow AST traversal.
        
       | hashemian wrote:
       | If you are interested in this topic, I suggest watching the
       | conversation between Edward Gibson and Lex Fridman. In the middle
       | of the conversation [1] Edward talks about how there is a "human
       | language comprehension network" within human brain, which gets
       | activated only when we read or speak in any human languages, but
       | nothing else. For example for those speaking multiple languages,
       | reading or writing in any of those languages activates the
       | network. But reading gibberish or computer code, neither activate
       | the network.
       | 
       | [1] https://www.youtube.com/watch?v=F3Jd9GI6XqE&t=4906s
        
       | randomdata wrote:
       | Stands to reason. The brain has to constantly resolve ambiguity
       | when reading natural languages, while artificial languages are
       | (usually) designed to be free of ambiguity.
        
       | JumpinJack_Cash wrote:
       | Duh, not even reading math is the same as language.
       | 
       | That, I feel, is the greatest barrier for math teaching in our
       | education system.
       | 
       | The need to compress everything into a line or two, supposedly
       | for ease of transcription and speed.
       | 
       | Hopefully VR and AR can bring about a novel way to teach math
       | which is much more visual/extensive and less about signs and the
       | need to compress
        
         | djtango wrote:
         | While names reveal intention I do find it easier to reason
         | about code when everything has one letter variables. If I'm
         | trying to think about an algorithm or just some complex logic,
         | the shorter the names, the easier I can manipulate things and
         | reason about them I have found
        
           | JumpinJack_Cash wrote:
           | What I am trying to convey is that presently your way is the
           | only way, whereas we deserve something to enable everybody to
           | contribute.
           | 
           | Much like some people get their best intuitions under the
           | shower whereas others do it while walking, other still have
           | them while listening to music...
        
       | xg15 wrote:
       | 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 like "constructing" some sort of
       | entity - a formula, an algorithm, a data structure, an
       | architecture of different components, etc" than it is about
       | communication. Consequently, a lot of "thought" when programming
       | is about the implicit properties of that thing being constructed
       | and less so about the syntactic specifics.
       | 
       | You _can_ do the same in human language, e.g. if you write a
       | recipe, a legal text, a mathematical definition, rules for a
       | board game or instructions for an LLM, but human language can
       | also be used for many modes of communication that have completely
       | different purposes.
       | 
       | I think a comparison of brain activity between reading computer
       | code and reading formalized human language - or between reading
       | formalized and non-formalized human language would be more
       | interesting.
        
         | itronitron wrote:
         | >> Making programming languages superficially more like human
         | languages is one of the classic rookie mistakes
         | 
         | one of the least productive programmers I've worked with was
         | obsessed with Groovy
        
         | Izkata wrote:
         | 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.
        
       | calibas wrote:
       | To me, reading new code is like separating a bunch of string
       | that's been tangled together. What thread goes where, what's it's
       | purpose, how is it connected to the other threads? It's a very
       | active process.
       | 
       | Reading language is different, I move my eyes left to right, top
       | to bottom, to consume someone else's ideas. It's a much more
       | passive process than reading code.
        
       | neom wrote:
       | I'd be curious to see some research like this done in children
       | with dyslexia. Dyslexia seems to like things that more
       | bilaterally use MD (I'm dyslexic so I often think about brain
       | functioning in that context).
        
       | ginko wrote:
       | This feels intuitive to me. At least for programming languages I
       | know well "reading" code is more like looking at it from a
       | structural point of view. Like reviewing a diagram or flowchart.
       | 
       | I don't usually read code from front to back like you do with
       | natural language.
        
       | nickdothutton wrote:
       | To me, reading code is more like looking at one of those pictures
       | of a set of gears and then being asked whether "gear A turns
       | anticlockwise or clockwise". At least this is how it feels. It's
       | more like studying a mechanism than understanding language.
        
       | jwie wrote:
       | 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.
        
       | rhelz wrote:
       | What if I'm reading very well commented code?
        
       | hotdogscout wrote:
       | Is this not the case for almost everything? Show a dog and show a
       | cat and it'll light up different parts on the MRI.
        
       | alentred wrote:
       | Not to dismiss the study - I agree that hypotheses require proofs
       | - but, based on my personal experience coding *feels* much more
       | like math, and almost not at all a spoken language, except for
       | the fact that we give identifiable "names" to things (keywords,
       | variables, functions, etc.). Well, not unlike in math in fact.
       | 
       | I wonder if the authors (neuroscientists) discussed the premise
       | with programmers and linguists to formulate the hypothesis. I
       | mean, I would say that the question should have been: are the
       | same regions of the brain activated when doing
       | math/chemistry/physics/neuroscience(so meta!)/science and coding,
       | instead of when talking/writing/reading and coding.
       | 
       | Maybe there are people who experience coding differently -
       | please, let me know if so, but I would be so much surprised.
        
         | bborud wrote:
         | It would be interesting to look at programmers with very long
         | (2-4) decades of experience solving programming tasks in
         | different domains. Also, I'd be interested in seeing what
         | happens when they write code for domains entirely new to them
         | vs very familiar.
        
         | aleph_minus_one wrote:
         | > based on my personal experience coding _feels_ much more like
         | math, and almost not at all a spoken language
         | 
         | To me, both spoken/written natural languages and programming
         | languages feel a little bit like math. :-) (no joke!)
         | 
         | I thus often tend to analyze subtle aspects of words just like
         | one does code audits for hidden backdoors (admittedly - native
         | speakers of English agreed - this is easier and more yielding
         | to do in German, my native language, than in English).
        
       | nurple wrote:
       | 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.
        
         | Salgat wrote:
         | 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.
        
           | aleph_minus_one wrote:
           | > Completely different skillsets as far as I'm concerned.
           | 
           | My experience differs:
           | 
           | I find the way how programming is typically (also
           | self-)taught much more fitting to my brain than how natural
           | languages are (also self-)taught.
           | 
           | From my experience I do believe that if natural languages
           | were taught in a different style, it would be much easier for
           | a programmer brain to get good in them (I also consider it to
           | be plausible that there might exist a way on how to teach
           | programming languages that is more natural to "language-
           | minded brains").
        
         | kkarakk wrote:
         | [link]https://youtu.be/F3Jd9GI6XqE?t=4847 to relevant section
        
       | IIAOPSW wrote:
       | 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 automatically
       | turned into flow charts. More generally, it would ensure the
       | documents conforming to the standard are able to be "read like a
       | machine" to a certain degree (if not outright machine readable),
       | which has implications for the ability of regulators and judges
       | to "debug"/"trace" situations, or to pro-actively identify "edge
       | cases", or to make tooling which assists with analyzing the
       | documents and related paper trails, irrespective of the
       | particular organization where the matter came from.
       | 
       | So as a follow up to this research, I'm really interested to see,
       | does the brain read legal/formal documents more similar to how it
       | reads code, or more similar to how it reads natural language. Or
       | is it somewhere in between? Does it change when we introduce some
       | syntax constraints on the legal documents? How much rigid syntax
       | does there need to be before the brain switches from one mode to
       | the other?
        
         | Izkata wrote:
         | > 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.
        
       | bossyTeacher wrote:
       | This has been obvious to know who programs and speaks more than
       | one language fluently. There was a government of an anglosaxon
       | country trying to replace a language subject with programming
       | arguing that programming is a language so kids should be able to
       | choose between foreign language or programming
        
       | SaintSeiya wrote:
       | 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.
        
         | itronitron wrote:
         | Yes, and I think the argument could be made that code is the
         | exact opposite of language, since it's a set of machine
         | instructions that lay out what the computer will do and can't,
         | or won't or shouldn't, be a metaphor for something else as
         | happens in the domain of language.
        
         | tgv wrote:
         | 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."
        
       | mcfedr wrote:
       | Thanks cap!
        
       | byyoung3 wrote:
       | would rather just do a fmri than a leetcode interview....
        
       | kderbyma wrote:
       | Programming is more spatial than linguistic. It requires temporal
       | understanding in order to formulate, and usually data
       | 'structures' are based around physically laying data out.
        
         | aleph_minus_one wrote:
         | This claim does hold or imperative programming languages, but
         | does it also hold for strongly declarative ones?
        
       | gls2ro wrote:
       | I am wondering if the domain model is not influencing the
       | results.
       | 
       | If the code is describing a math function then it seems to me
       | reading it will activate the same parts as math.
       | 
       | What if they will read a business logic that is about say users
       | creating accounts?
        
       | thefaux wrote:
       | > "Understanding computer code seems to be its own thing. It's
       | not the same as language, and it's not the same as math and
       | logic," says Anna Ivanova, an MIT graduate student and the lead
       | author of the study.
       | 
       | I'm not sure if this is what they are implying but I find the
       | statement "reading computer code is the same as reading language
       | or math or logic" to be an odd null hypothesis.
        
         | karmakaze wrote:
         | Every one of these are languages and I'll add music. The
         | purposes and constructed of these types of languages vary so
         | should the thought processes.
         | 
         | Computer programs can be written in a proof/solver language
         | which would get closer to math/logic. This puts things on a
         | grayscale IMO.
        
       | janandonly wrote:
       | Bah. This scientific research completely undermines the premise
       | of the book "Snowcrash" that I just finished reading, and loved.
        
       | smitty1110 wrote:
       | 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.
        
       ___________________________________________________________________
       (page generated 2024-05-26 23:00 UTC)