I’ve been intrigued by languages for a very long time. Back at home in Poland I studied English and German and planned to go on to do a degree in Chinese. When I moved here and decided to study programming I noticed all the patterns that both human and coding languages share.
What is language?
So to begin, what do we mean by language? According to Wikipedia, ‘language is the ability to acquire and use complex systems of communication, particularly the human ability to do so, and a language is any specific example of such a system.’
In other words, languages are simply systems of communication.
A brief history of language
Human languages, such as English, Polish and German, are created through use over time. They’ve existed and evolved over thousands of years to become the tongues we speak today, and they continue to mutate.
The origins of programming languages are very different: they are designed and created over a short space of time by an individual or a group who is trying to solve a specific problem following a particular structure. Rather than growing organically, they’re created with a purpose in mind.
Languages are generally a part of a family – a group of languages that come from a common ancestor. For example English and German are Germanic languages, whereas Polish comes from the Slavic family. Similarly, in programming there are families such as the C languages, Lisp and Audio.
Languages from the same family share many similarities, and this applies to both human and programming languages.
Looking at the example below, it’s clear that English and German both come from the same family – both syntax (noun, verb, determiner, noun, determiner, noun) and vocabulary are very similar – while Polish has a completely different structure (verb, noun, noun) and the words are derived from different roots.
German: Ich gab dem Jungen einen Ball.
English: I gave the boy a ball.
Polish: Dałam chłopcu piłkę.
Following these examples, we could assume that if we know one language in a family of languages then learning another one in the same group would be fairly easy. Of course it’s not that simple. Vocabulary differs even in languages of the same family, and some languages have words that don’t exist in related tongues. The German word kummerspeck is one such example, and translates to English as ‘excess weight gained from emotional overeating’. In programming, you might know the syntax but won’t be able to create an application not knowing the language specifications, such as the API (application programming interface) or the standard library.
Ultimately, programming language is made for human readability (though it may not seem this way to non-coders). Professors Harold Abelson and Gerald Jay Sussman at the Massachusetts Institute of Technology write that ‘programs must be written for people to read, and only incidentally for machines to execute.’
Coding is about us communicating to computers what we want them to do, so we need to be able to read and write it too. Programming languages contain words such as ‘for’ and ‘if’ because it makes it easier for us humans to understand, and we often indent our code – like with paragraphs in human languages – to make programs more digestible.
Vocabulary also applies to the words in our code, like variable names. We don’t go around calling everything ‘thing’ or ‘it’ because that would get very confusing very quickly. Badly named variables can lead to misunderstood code, which can lead to bugs, and names that are too long can be hard to remember, hard to type out correctly, and hard to spot errors in. Variable names should be concise yet descriptive.
Another way we make code more readable is to avoid nesting, i.e. grouping large functions together. By splitting one large function into a few smaller, properly named ones, the code is often optimised and easier to understand.
How does it all help?
So, as we’ve seen, human and coding languages aren’t all that different. Both are about communicating using a certain syntax and a specific vocabulary, and, once you know the rules, both are easy for humans to understand. So how does learning human languages have a positive impact on coding and vice versa?
One positive impact is that you quickly develop an eye for patterns. You begin to see the way in which a piece of text or code is structured, the rules that govern that structure, and the vocabulary, words or commands used. This makes it easier to understand large sections of code and spot errors quickly. It also makes it easier to learn new languages, both human and programming.
Another benefit to learning languages is that you’re forced to think about things in different ways. This is important for everyone, not just programmers and linguists. When exploring a new syntax or vocabulary, you often need to approach what you want to say from an unusual angle. In programming we could take the example of Java and Haskell. Java is an OOP (object-oriented programming) language, which means that when you code, you need to think about objects rather than actions. Haskell, on the other hand, is a purely functional programming language focused on actions. Each language can solve the same problem but in totally different ways.
As such, when you approach a problem you can view it from more than one angle. Even if you can’t necessarily use a different language or code in a particular situation, that extra perspective often provides depth and leads to an intuitive solution, which is valuable whatever your line of work.
Are you an aspiring coder? Take a look at our tips for getting your first web dev job.