News for hackers. Stuff that matters.
Re:To the brain, reading computer code is not the same as re... by ants_everywhere on Sunday May 26, 2024 @10:42AM (#40482543)
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.

Re:To the brain, reading computer code is not the same as re... by nico on Sunday May 26, 2024 @10:54AM (#40482625)
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

Re:To the brain, reading computer code is not the same as re... by tetris11 on Sunday May 26, 2024 @11:04AM (#40482704)
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,

Re:To the brain, reading computer code is not the same as re... by recursive on Sunday May 26, 2024 @06:08PM (#40485842)
If you're lucky enough to be working on your own code, that can work.
Re:To the brain, reading computer code is not the same as re... by kinos on Sunday May 26, 2024 @06:29PM (#40486000)
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.
Re:To the brain, reading computer code is not the same as re... by gsuuon on Sunday May 26, 2024 @10:33PM (#40487139)
Note taking is great not just for recovering from distractions but also preventing them in the first place. Just jot down branching tasks that would've been a distraction and come back to them later instead of being the Hal fixing a lightbulb meme.
Re:To the brain, reading computer code is not the same as re... by Nevolihs on Sunday May 26, 2024 @07:04PM (#40486198)
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 re... by spacetimeuser5 on Sunday May 26, 2024 @12:21PM (#40483317)
>>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.

Re:To the brain, reading computer code is not the same as re... by ants_everywhere on Sunday May 26, 2024 @02:15PM (#40484192)
This is pretty fascinating, thanks!
Re:To the brain, reading computer code is not the same as re... by inciampati on Sunday May 26, 2024 @10:47AM (#40482578)
To me reading code is reading math. It feels exactly the same. Same pattern about holding lots of things in mind at once.
Re:To the brain, reading computer code is not the same as re... by cgriswald on Sunday May 26, 2024 @11:12AM (#40482763)
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”.

Re:To the brain, reading computer code is not the same as re... by nkozyra on Sunday May 26, 2024 @10:57AM (#40482648)
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.
Re:To the brain, reading computer code is not the same as re... by jack_riminton on Sunday May 26, 2024 @10:58AM (#40482654)
What coding language/s do you normally use and what things are you most often coding?
Re:To the brain, reading computer code is not the same as re... by SoftTalker on Sunday May 26, 2024 @03:23PM (#40484659)
> 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.

Re:To the brain, reading computer code is not the same as re... by ants_everywhere on Sunday May 26, 2024 @09:10PM (#40486744)
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.