30th December , 2012

The Similarities and differences between languages and programming

matrix1 300x225 Learning programming and learning languages are very similar in many ways. If I phrase it as 'learning how to code and learning how to communicate in a foreign language', the similarities become much more apparent. As learning how to communicate in a foreign language, is basically coding your native language into that foreign language. Similarly learning how to code is like learning how to translate logical thinking from your native language into a machine-read language (i.e. something a computer can understand). In broad terms there are some key differences between what you need at a basic level for learning English to say learning JavaScript.

At the most basic level - Syntax

First, a programming language has a finite amount of commands. Loops, if statements, objects etc... after you learn all the basics of a programming language and what they do, this is like your alphabet. With this alphabet you can pretty much do everything you want with the language as all that needs to understand your code is the computer. However in a human language, the alphabet is only the beginning. With English there are tens of thousand of words to learn and you need several thousand atleast to have the most basic of conversations that don't involve you just memorising preset sentences about your friends, family or hobbies. In this specific way, a programming language is much easier to learn as you can learn all the commands for a language in a week, but it may take years possibly decades to learn 99% of English words if you only studied that. If the end goal is to communicate on a basic level to your target audience (i.e. a computer or a human), then programming takes a much shorter time to get there as you probably need several thousand words in your target language to speak to a native fluently.

At the most basic level to be useful - Communication

However programming is largely about solving problems or automating solutions that humans would find tiresome or impossible. In this way, the most basic of goals for learning a programming language would be to solve a problem. Just learning all the syntax of a language, will not allow you to do that. You need a basic amount of logical thinking and problem solving skills to utilise the programming language at a basic level. With human communication however on a basic level the need for logical thinking drops significantly. It's about outputting some language and understanding the input you get back from the person you're having a conversation with. Having a good conversation is a different story, but on (as I'm emphasising constantly) a basic level, this I would say would suffice.

Some other things:

In programming, keeping statements short and clean is seen as good practice and keeping things understandable. In language this would be seen as boring and monotonous.

In language there is much more emphasis on style and art, such as poetry, novels or scripts; whereas in programming there is a lot more talk about standards and doing things the same way as it keep things readable and efficient.

In language there are many people that speak technically incorrect, but is seen as natural and are clearly understood with even thinking about grammar. However in programming, if syntax or grammar is ignored, your program simply won't work as a computer cannot interpret a language like a human can.

These differences are purely based on the differences between communicating with humans and computers.

However...

However despite all these polar differences between human languages and programming, a master at programming and a master at language both strive for the same goal. Being able to communicate their ideas fluently. And to achieve this, the language needs to fall away. Fluency is about knowing the ins and outs of any language that communication becomes a second nature, and when you master it - it becomes a joy. When you become a linguist in languages, you may write books or poems or articles. Your writing becomes more than communicating ideas, it communicates emotion, joy, sadness, euphoria. I believe the same is true in programming, when you master it, the importance of language falls away and you can create amazing software where hundreds or thousands of people feel joy when using it. When you don't have to think about 'how' to do something, you are thinking more about 'why' you should do something and that's when things start to become great. It begins to become art.

In my next post about programming/languages I'm going to write more about how learning a foreign language can help you to learn programming or vice versa. So check back for that!