r/programming • • Dec 16 '20

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

https://news.mit.edu/2020/brain-reading-computer-code-1215
4.4k Upvotes

546 comments sorted by

View all comments

216

u/TheMaskedHamster Dec 16 '20

As someone who is a programmer and multi-lingual (successfully acquiring foreign languages as an adult), this is very gratifying to read.

I have seen a lot of articles and comments over the years comparing them, and even ridiculousness such as replacing language classes with computer programming. It's not something you can explain well to someone without experience doing both, and those people don't need an explanation. I haven't heard it in a while, but I have remained tired of it nonetheless.

137

u/glacialthinker Dec 16 '20

I'm surprised to learn that some people think reading or learning programming languages is related to natural languages. Just because they're called languages? I'm already tired of it too, and this is the first I've heard of it!

26

u/EntropySpark Dec 16 '20

Programming languages are really different programming grammars, as the words are all still English. If there was an alternate form of English in which the words were generally the same, but the word order was different and the cases were simplified, would that be considered a different language, or a different grammar? Is that even a concept?

17

u/Quadraxas Dec 16 '20

A lot of programming languages are really just different syntaxes, not even grammars.(sure there are many different grammars too but hear me out) Constructs or how you describe things are mostly same. Sure they have all their nuances and their own sugar, or the way they represent and process data is different but what would you call a "grammar" is the same. Well, like among C family languages the syntax is even very close. But there is still also a great deal of similarity in say, c and python, grammar-wise, so much so that you can implement same psuedo-code with 1:1 mapping of instructions and their order in both.

13

u/Thaun_ Dec 16 '20

Arabic Programming Language.

You write from right to left.
You have to learn the whole arabic alphabet and know how to speak it.
Its unmaintainable as fuck if you don't know arabic.
Mostly noone will understand the logic of the code, cause they can't read it.

14

u/njtrafficsignshopper Dec 16 '20 edited Dec 16 '20

Alphabet, yes. How to speak it, no, apart from some key words.

I had some co-workers in a company who did not speak English or indeed a language that used the Latin alphabet, but managed just fine with English-based programming languages. The words they had to know were limited to "for," "if," "class," and the like. It's nowhere near comparable to the complexity of learning a natural language.

Of course, you would still need documentation in your own language, but then we're back to the realm of human languages, not programming.

Edit: for example, here's a list of all the English words you need to be able to use C#. Well, maybe a couple more for ubiquitous class names like List and Console. But all in all maybe ~100 words. You don't need to know English to use C#. Same for this proposed Arabic-based programming language.

2

u/vytah Dec 16 '20

f course, you would still need documentation in your own language, but then we're back to the realm of human languages, not programming.

Microsoft offers machine translations for all .NET reference docs on MSDN. For those who speak English, it's a minor annoyance. For those who don't, it's a lifesaver.

→ More replies (1)

2

u/sinedpick Dec 16 '20

English is a context free language and it's easy to describe if you allow some your CFG's rules' parts to commute around the 'followed by' operator.

This elaborates, and is very accessible https://english.stackexchange.com/a/60761

may answer some of your questions in the general sense

9

u/[deleted] Dec 16 '20

This theory was brought to you by insular monolingual American academics™ (isn't calling "academics" insular redundant?)

SQL is basically an attempt to make a programming language with a "natural English" grammar. Then people realized that's stupid as fuck and AFAIK the trend has since died, and though SQL is still around nobody reads or writes SQL as if it were English.

5

u/Gecko23 Dec 16 '20

BASIC and COBOL were intended to fit the same model. They aren't remotely similar to spoken language either.

2

u/doktor_wankenstein Dec 16 '20

Been coding in COBOL for 35+ years... depending on the programmer (and their use of mnemonics), it practically reads like English.

0

u/Packbacka Dec 16 '20

Python is similar.

0

u/[deleted] Dec 16 '20

Not really? Its syntax is inspired from pseudo-code, meaning its core syntax is heavy and keywords and short on symbols, but that's a far-cry from something like SQL that is designed so that queries can be read as full sentences.

→ More replies (1)

0

u/editor_of_the_beast Dec 16 '20

I believe they are the exact same mechanically, as in how your brain processes the language. If you read anything about linguistics / semantics it’s pretty clear that languages have the same goal - to denote and manipulate conceptual objects.

So I think the language mechanism is the same between programming and spoken language. But the objects and common patterns for manipulating them are different.

1

u/crowbahr Dec 16 '20

My understanding is that multilinguals generally do better at coding than average even controlling for other factors.

Having learned a second language to a high degree of fluency as an adult I know for a fact that they're very different but there are definitely some quirks between them that are the same. Flow state is useful for both types of language obviously but there's a certain type of mental exhaustion that I haven't experienced except when learning code for the first time or after a long day of speaking Italian when I was new.

Some other quirks like thinking in the foreign language sorta happens with code, but it's more abstract/structural while foreign language tends to be a bit closer to the language in thought.

1

u/shadeofmyheart Dec 16 '20

It’s not just cause they are called programming languages. Programming is, at its heart, communicating instructions to a machine to do something. You are speaking to the machine.

→ More replies (4)

13

u/ShapesAndStuff Dec 16 '20

Yea i wanna know why this is a thing at all.. One is communicating and one is solving logic problems. Just because you use words (in the broadest sense) to do both it doesn't mean they're alike.

6

u/Kissaki0 Dec 16 '20 edited Dec 16 '20

You use more than words. You use words, and grammar (structure).

And those constructs represent a concept, a meaning.

You read and write them. And that is a transformation of their meaning into a textual representation. The meaning you interpret unconsciously and understand consciously. You form ideas in your head of what they represent.

There are some similarities. It’s not that far off.

5

u/Semi-Hemi-Demigod Dec 16 '20

I disagree that programs convey meaning. Sometimes that's true, and there should be a comment describing what that meaning is. But it's more like a to do list than prose or poetry: The end result isn't conveying an idea, but getting a machine to execute the steps to achieve the desired result.

→ More replies (2)

2

u/ShapesAndStuff Dec 16 '20

The process and goal are entirely different though.
And you don't write concepts and meanings as much as instructions.
As I said, it's communication vs problem solving.

→ More replies (3)

7

u/Awesan Dec 16 '20

I'm bilingual and I've been a professional programmer for almost 10 years at this point. They seem pretty similar to me?

When reading code, I'm not reading the syntax but the meaning. I create a picture in my mind of what will happen when it runs.

When reading text, I'm also not reading the words but the meaning. Again I create a picture in my mind of what is being described.

The difference is in what they describe, not how they do it in my experience. That's what I would guess is the reason for what the article describes, the subject matter is different and people use different brain areas for different subjects.

→ More replies (4)

1

u/rockbandit Dec 16 '20

When I switch between two different projects or code bases written in different (programming) languages, it's like there's some cognitive overhead as I context shift and my brain tries to "boot up" and remember the correct syntax, project structure, any particular design patterns, etc. It's kind of annoying, honestly.

How does this work for someone who speaks more than one language? I’ve only know English and have no idea what this is like.

Unrelated: I heard a funny joke ages ago about language. What do you call someone who speaks three languages? Trilingual. What do you call someone who speaks two languages? Bilingual. What do you call someone who speaks one language? American (it's me).

1

u/the_goose_says Dec 16 '20

I’d argue the first few months is very similar. Once you’re a professional, it’s much more about problem solving skills and things of that sort.

1

u/AttackOfTheThumbs Dec 16 '20

Yeah, it's nothing alike. I can start programming in an unknown language in less than a day. I can hack together some shit without having spent any time in that language. I can reason about it and come to a real resolution. Give me a few weeks and I'll be proficient. A year and I'll be fluent.

I can't do that with a language. I'll spend weeks learning basics just to have a primitive conversation. It'll take months before I would consider myself proficient. Years before fluent. That's my personal experience. I know some people learn languages fast (or fake learning them, see literally any polyglot youtube video).

1

u/Broiledvictory Dec 16 '20

Also multi-lingual and a programmer like you

And I think we're in the same exact boat, I always found it very exhausting