r/coding • u/speckz • Dec 17 '20
To the brain, reading computer code is not the same as reading language
https://news.mit.edu/2020/brain-reading-computer-code-1215[removed] — view removed post
39
23
7
u/ByronScottJones Dec 18 '20
I've always believed that as much of the "coding" should be done in plain English as possible, PRECISELY because we are able to think and communicate so much faster in human languages. I comment out each function first, and only write the actual code once I've explained everything in plain English first. I find it helps tremendously, not only with writing it the first time, but when I have to come back to that code months or years later.
6
u/Cadecu Dec 18 '20
This is actually great advise to beginners and experienced coders alike.
0
u/ArkyBeagle Dec 18 '20 edited Dec 18 '20
So you'll write down what you think it does when you wrote that. One week later you will have learned enough about what you actually coded/wrote that this will be charmingly obsolete.
Edit: Dear downvoters. Have you people every actually worked on a real product? I have.
1
u/ByronScottJones Dec 18 '20
Well if that's the case, then all is the actual code you wrote as well. Would you rather redo 100 lines of plain English, or c++?
1
u/ArkyBeagle Dec 18 '20
That depends on what I am doing. This is the point - there's a time for vagueness and a time for being specific.
1
0
u/ArkyBeagle Dec 18 '20
As someone who's studied natural language just enough to be dangerous, I think this is a terrible idea.
I think of a natural language description of say, "commit a transaction" as:
For all x such that x is a line item indicating an element of inventory in a transaction, decrement the available count by one, increment the sold count by one, debit total sales for that SKU by the amount and credit goods sold by the amount.
That's a massive oversimplification - it leaves out reams of detail, and it's still hard to read.
90% of my job is saying "wait - by that do you mean..."
Natural language is ambiguous. That's why we have jargon, where we round up/down specific words to specific meanings.
1
u/ByronScottJones Dec 18 '20 edited Dec 18 '20
To be clear, I didn't say I was using a natural language system. The plain English is literally for me, not the computer. The English language description only has to cover enough to capture the concept clearly. That description becomes the comments when the real coding is done. But it makes it SO much easier when you write the actual code, because your no longer have to hold as much of the architecture in your head.
1
u/ArkyBeagle Dec 18 '20
because your no longer have to hold as much of the architecture in your head.
That's a separate issue, one of partitioning.
13
2
2
3
u/metriczulu Dec 17 '20
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. The MIT team found that reading computer code appears to activate both the left and right sides of the multiple demand network
Interesting, I wonder if reading code looks similar to solving geometry problems in the brain then?
2
Dec 18 '20
I would think so. Wasn't really into geometry at school but when doing processing I definitely had to remember some of it. Was slightly tricky getting used to all the coordinates of shapes (like they weren't centered instead at the left edge of shape).
2
1
Dec 18 '20
I want to teach myself math's and learn another language. Just because I want my brain to be the best it can at programming.
I feel like coding is like solving a big puzzle, or like algebra.
Thanks for sharing really fun read :)
25
Dec 17 '20
[removed] — view removed comment
8
u/CrAzYmEtAlHeAd1 Dec 17 '20
This is where it's really different. I would think it would have to be similar from this angle. When you first start, you're learning how to tell the computer to do math. When you are fluent, you are just solving logic problems with code.
7
u/productionx Dec 18 '20
kinda mind blown on your response here.
not in any traditional way but the reflection of seeing.
i have become the machine code generators interpreter.
62
u/[deleted] Dec 17 '20
I mean, duh?