How do Programming Languages Compare to Human Languages?

Posts21Likes25Joined9/5/2022LocationBerlin / DE
Native
German
Learning Chinese - Mandarin, Dutch, Croatian, Italian, Russian, Spanish

As someone who has learned more than a dozen human languages and seven programming languages, I am often asked how the two compare and whether someone who is good at learning one will also be good at learning the other. The answer is complicated, so I will take it aspect by aspect.


Vocabulary


The vocabulary of programming languages is almost always based on English and it has been chosen to be relatively easy to understand for people who speak English. Consider this:


if it_rains then

    my_home.windows.each do |window|

        window.shut!

    end

end



... all of these are, on the surface, English words. The effect is that (assuming I live in a smart home where the computer controls the windows) if it rains, this Ruby code will loop over the windows in my home and shut each one. Hint: in well-written code, the indentation helps you see what belongs together, i.e. lines 2-4 are only run if it rains, and line 3 is executed for each window.


There are programming languages where the names of commands are not based on English, for example the table functions in Excel are usually translated: on a German computer, "SUM()" will be "SUMME()", "IF()" will be "WENN()" and so on. There is also a programming language equivalent of Klingon, i.e. a language intended to be alien to the human mind and hard to learn. This programming language is appropriately called Brainfuck.



I coded my first program two years before I started to learn English. Not knowing English wasn't a big issue (the only lasting damage being that I am always tempted to pronounce "height" as "hey-t") because most programming languages have a vocabulary of less than 100 words. That being said, these days almost all programming involves additional classes/plug-ins rather than the pure programming languages, and these classes will add their own jargon. It is comparable to how, even after graduating high school, you still need to learn a lot of technical/medical/other terms depending on the field you'll work in.



Unlike in human languages, you will also be defining a lot of words yourself, i.e. variable names, class names and function names that you'll use at various points in a project and that you'll need to remember and spell consistently if you don't want to see weird malfunctions.


Grammar


Programming languages do not conjugate verbs and most do not care about noun plurals either. However, there are very strict syntax rules. For example, in line 1 of my example program, the thing that follows "if" needs to be an expression that is true or false. It could be a true/false variable like it_rains or a comparison like (x > 1). After "then" there shall be one or more lines of instructions. After "my_home.windows.each" you necessarily need either "do" or an opening bracket. After "do" you can have |window| or |x| but not e.g. a question mark or other punctuation, a single | character, or even window.shut!


Programming languages, like human languages, do not allow you to reference something before having defined it. If you have a line if x > 1 and you did not previously define x, your code won't execute. Similarly, if you leave out the |window| part in line 2, window.shut! won't work in line 3 because the computer won't know which window where. Similarly, in human languages, saying you met "him" when you haven't mention a guy before, or saying "Liz shouldn't have done this" when your interlocutor doesn't know anything Liz did, will leave people puzzled.


Usage


Usage is where human languages and programming languages really differ. Programming languages are never spoken, so you can forget about working on your listening comprehension or speaking abilities. You only need to be able to write. And probably read. In some programming languages, writing is a lot easier than understanding something that has been written, while in others it's the other way round. It also depends on the programmer. Good programmers write in a way that is easy to understand. But in the end, human comprehension of the code is not essential. What matters is that computers understand it correctly. And for that, the key factor is that every assumption must be made explicit and every contingency must be covered.


For example, my little code snippet assumes something called my_home. It has to have been defined previously in the code, otherwise the computer won't try to guess. Computers are much, much worse at inference than humans. They have to be told every little thing. For example, what if they are instructed to shut a window but the window is already shut? Or what if they are in a house under construction and the window is just a hole in the wall for now - how are they supposed to shut that? Humans have common sense, computers don't.


Learning


Since the vocabulary consists of less than a hundred words and these are identical to English (if used somewhat differently), learning vocabulary does not take a lot of time in your education as a programmer. The syntax also isn't terribly difficult, though you may find it hard to eradicate fossilised mistakes, e.g. forgetting to end each statement with a semi-colon if you come from a language that doesn't do that.


What's so difficult about learning to code then?


It's the mentality. It's learning to communicate in a overly clear and structured way that you never need when talking to humans, no matter which culture. Imagine telling someone to open the door. In every human language, you will translate something like "Open the door", "Could you please open the door?" or "It would be great if someone opened the door". Whereas when translating this request into a programming language for a robot to follow, you need to be ready to say something like "Walk forward until the distance between you and the door is less than two meters. Extend your arm forward at a height of one meter until you feel a handle. Close your hand around the handle. Push down. Move your arm backwards and to the right. If you feel the door touching you while moving your arm backwards and to the right, take a step backwards to get out of the way of the opening door. ..." ... this is the SHORT version and it's not even complete.


Conclusion


While programming languages also have vocabulary and syntax, being good at memorizing vocabulary or applying syntax is not the most important skill for programmers. Programmers primarily need to be able to think in very structured, very detailed ways. If you are good at that, then yes, being good at spelling and memorizing are valuable skills also in programmers - but no amount of memory power can make up for an inability to structure things.


Accordingly, I have not found many programmers who are also very good at human languages. More commonly, they are good at process planning, i.e. what needs to happen when and in which order, at understanding large systems, or at math (though I personally am not). When learning languages, programmers often despair about inconsistencies (why is it "I ring - I rang" and "I sing - I sang" but not "I bring - I brang"??) and things that native speakers say "feel right" or "feel wrong" without any clear rules. They are often drawn to the more structured, more logical languages, such as Latin or Esperanto.


I'd still say that if you have learned at least one foreign language to a high level, that can help you when learning programming languages, because you will know that English is not the measure of all things and that you have to think in-culture in order to come up with the most appropriate way to phrase something. This ability to switch between your culture's mindset and a completely different culture's mindset, and then communicating in their preferred style and including the kind of details they care about (which may be less relevant in your culture), is a good ability to have and to train, whether for human languages or programming languages.


If you are a polyglot looking to learn a first programming language, I recommend Ruby, because it's both easy and useful. If you're coming the other direction, try Esperanto! A friend compared it to learning the recorder before learning the saxophone - the underlying basics of music and playing an instrument are the same, but the recorder is much simpler, thereby allowing you to concentrate on mastering the essentials. For me, Esperanto (which I learned as my 5th language) has also helped me better understand languages as different as Arabic, Swahili and Indonesian.


Good luck in your studies!




I offer personal language coaching if you like.

Edited 
1
#1
Do you want to crush your language goals? Sign up here.
Want to learn more? See the other blog posts
    Feedback