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

Show parent comments

231

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

Out of curiosity, have you learned a second language?

I'm working on my 5th human language now, while I'm also having to learn new programming languages for work, and use ones I'm comfortable with. Both of these are experiences I'm familiar with. They don't feel like similar processes to me at all, and the results of this study are totally unsurprising.

I don't think it's particularly unbalancing to the study that they're students. You say that "programming languages are by default second languages" but this is begging the question.

*Edit for typo

126

u/tomoe_mami_69 Dec 16 '20

Additionally, that the complexity of the syntax and "vocabulary" (keywords) of a programming language is so low that it's not comparable at all to the amount of learning required for a human language. Most programming languages don't even have a hundred keywords.

Learning another human language is a mentally tasking endeavor that requires hundreds of hours of speaking, listening, and rote memorization. Learning another programming language is opening up the syntax guide, reading through it a few times, and googling whatever you you don't know.

60

u/ZoeyKaisar Dec 16 '20

It depends- try jumping linguistic paradigms, such as from C-family languages to pure, functional programming, and it can be a much less trivial effort. The syntax may be simpler than a human language and the vocabulary may be smaller, but human languages are rarely used to such precision as is required for correctness in programming, so the complexity is often significantly more dense per token in a computer language.

23

u/yoctometric Dec 16 '20

very anecdotal but six years of public school Spanish barely got me to the kindergarten level while after about a month of python I feel 'fluent' in it

17

u/itb206 Dec 16 '20

After two months you're likely still a beginner.

Quickly, without looking can you write me some code using either Python's threading or multiprocessing modules?

Or how about using itertools to more performantly work with collections.

Etc.

The thought is not to put you on the spot but I really doubt you have fluency as you put it even if you feel it. Learning the advanced parts of a programming language to a suitable degree is a slower process.

Just the other day I had to give advice to someone who 'said' they'd been writing python code for 2 years said they had a horrible time with some online course that requires intermediate-advanced Python skills and they were struggling to translate the concepts and pseudo code into code. Obviously anecdotal but I suspect it takes quite a bit to form the proper internal models before you can translate a semi difficult problem statement into a programming language which I would definitely consider a part of fluency.

I think it just feels easier because to be frank basic programming isn't hard and basic programming problems like making an API for a web app are just that, basic. The difficulties come in at a higher level there like design and architecture not the code itself really.

And this isn't really to discourage you that's just the magic of programming you can do some really powerful things fairly early on!

0

u/[deleted] Dec 16 '20

[deleted]

→ More replies (9)

20

u/[deleted] Dec 16 '20

Quickly, without looking can you write me some code using either Python's threading or multiprocessing modules?

Or how about using itertools to more performantly work with collections.

You're talking about familiarity with random libraries, not skill with the language

Just the other day I had to give advice to someone who 'said' they'd been writing python code for 2 years said they had a horrible time with some online course that requires intermediate-advanced Python skills and they were struggling to translate the concepts and pseudo code into code. Obviously anecdotal but I suspect it takes quite a bit to form the proper internal models before you can translate a semi difficult problem statement into a programming language which I would definitely consider a part of fluency.

Time is not a great measure for that. Writing same web app 6 times won't teach you as much as diving in some problem deeply.

Even then you might dig into problem while still using just basic language features, just because nothing more complex was required

I think it just feels easier because to be frank basic programming isn't hard and basic programming problems like making an API for a web app are just that, basic. The difficulties come in at a higher level there like design and architecture not the code itself really.

Ding ding ding! And those skill are not necessarily even that much tied to language itself. Writing good data structures isn't that much different between different languages, using those structures isn't that much different either. But it it hard to know which parts of that knowledge are generic till you know more than one language at more than basic level

→ More replies (2)

8

u/loup-vaillant Dec 16 '20

Quickly, without looking can you write me some code using either Python's threading or multiprocessing modules?

Or how about using itertools to more performantly work with collections.

When I was in college (over 15 years ago), learning a languages meant learning its syntax, semantics, main idioms, and the most used parts of the standard library. Any professional programmer can learn that in a couple weeks, unless perhaps they've only learn one paradigm, and the new one is totally different.

Now it means learning an entire ecosystem, including a significant amount of libraries, the community's preferred build system (or even package system), the main IDEs, and in some cases the primary business domain it is applied to. Well, anyone would take months, even years, to get up to speed.

The semantics of a programming language impacts everything, yet is increasingly disregarded. Community, support, tooling, available libraries… come well before the core semantics of the language. This does not feel like a good thing.

13

u/yoctometric Dec 16 '20

Right, well by now I've been using it for years off and on so I don't really know if this applies. Ive never really used the async libraries so no, I can't do that off the top of my head but I'm sure that 30 minutes with the docs would allow me to get something decent going. My point is that I could never imagine learning that fast with a human language

→ More replies (7)

2

u/maikindofthai Dec 16 '20

I think the point was that after two months of learning, you'll make more progress in a programming language than you will in a human language.

Whether or not they actually are fluent in Python is kind of irrelevant.

2

u/fuzzzerd Dec 16 '20

You make a good point, but it also begins comparing a programming language + libraries to a human language. Having mastery of python does not mean mastery of the libraries and frameworks it uses.

→ More replies (4)

6

u/alexiooo98 Dec 16 '20

Sure, the further you go from familiar territory, the more effort you have to put in. The same holds for natural languages, though, as a native speaker of an anglosaxon language, English was pretty easy to learn, but Japanese is much harder.

Both languages take way longer to learn than any programming language I've tried so far (and that includes the notoriously hard-to-learn rust)

8

u/MCBeathoven Dec 16 '20

as a native speaker of an anglosaxon language

Do you mean Germanic? Anglo-Saxon is a single language, also called Old English, and unless you're 900+ years old you definitely aren't a native speaker.

→ More replies (1)

2

u/ZoeyKaisar Dec 16 '20

I found Haskell to be more troublesome than Rust to get to the point of productivity in, but I will admit lifetime bounds on generics still confuse me from time to time. And- studying Japanese as a native English speaker- oh god this is taking forever, it’s been two years and I still have no idea what I’m doing.

3

u/celestialwaffle Dec 16 '20

It’s the correctness that actually makes it simpler. There have been moves, for instance, to create a limited version of English grammar and lexicon to cater to basic international communication such as Globish. However, it is very stilted sounding and wordy to the point it may be counterproductive. You couldn’t pick someone up at the bar with that subset of English.

When you approach a person in some cultures, your vocabulary changes depending on the cues from the person such as their age, gender, and race. The Romance languages, for instance, offer different pronouns based on familiarity and collective groups, and other cultures even have entirely different language subsets depending on gender and class.

Precision isn’t possible in human languages because it’s in a completely different, far more complex category compared to programming ones.

→ More replies (2)

4

u/seriousnotshirley Dec 16 '20

Writing a program is like that, reading a program is a different endeavor. Consider how many ways there are to do the same thing in Perl. Various languages have more or less idiomatic ways of writing.

While languages have few keywords a program can have a lot of function names and if it’s decently engineered you’re reading the language being built by that system. Take it another step up if you’re working with objects and design patterns. Even worse you’re often working with proper nouns (variables) for which you have little context to understanding what the noun refers to.

The language constructed by a program can be much more complex than that created by just the language.

19

u/BackgroundChar Dec 16 '20

I totally agree with what you're saying. I'm fluent in 2 languages and have basic knowledge of a third, but programming languages are entirely different processes to me. I spend most time thinking about the programming logic, so which steps will do what and get me to my desired result. This doesn't occur when speaking, reading or writing another language.

12

u/UnexpectedGeneticist Dec 16 '20

I can pick up programming languages pretty quickly for work. I can’t speak a second language to save my life. One is logic, and one is vocab memorization). In my mind they’re totally different

2

u/RoguePlanet1 Dec 16 '20

Opposite here. I can speak a second language almost fluently, picked up a tiny bit of a third, but learning programming is like wading through mud!

2

u/Procrasturbating Dec 16 '20

It's more akin to algebra word problems most of the time. There is a level of abstraction to it for sure.

3

u/itb206 Dec 16 '20

I've been writing code for like 16 years and it's generally become instinctive for me unless I'm in either an unfamiliar task or learning something or am being really really careful. Which I'd argue is the same in English for me as a first language.

→ More replies (1)

20

u/moi2388 Dec 16 '20

Your 5th human language? Okay.. how many animal or alien languages do you speak?

69

u/njtrafficsignshopper Dec 16 '20

It's my goal to one day communicate with The Zucc

11

u/0x0ddba11 Dec 16 '20

Sweet Baby Ray's... let's smoke some meats.

→ More replies (20)