Have you ever considered the similarities between learning a new human language and a programming language?
I have always been fascinated by this topic and it has inspired me to write a blog post to help those like me, who worry when we see the code.
I teach Spanish and speak five different languages. I have always been a curious individual and wondered if I can speak multiple languages, then maybe I could learn various programming languages with ease? This blog will discuss my experiences of learning a language and coding in different programming languages. Let’s not forget just as many human-based languages exist, there are numerous computer programming languages that programmers can use not only to communicate with a computer, but also do tonnes of things with it.
I must admit it’s challenging, but exciting and it has its benefits because not only you can understand them, but also communicate using them (human and coding languages), but it can be considered a great achievement which can also enhance your career options. As they say ‘the more the merrier’.
What is a language?
‘A language is a system of communication which consists of a set of sounds and written symbols which are used by the people of a particular country or region for talking or writing.1
What is a programming language?
‘Computer programming languages allow us to give instructions to a computer in a language the computer understands.’3
A little bit about myself
As a child, I was always surrounded by people who spoke different languages, and I naturally started making conversations with people in those languages. As time passed, I became more and more interested in learning languages, and at school, I took Spanish and German for my A levels. My love for languages inspired me to teach and help people learn.
On the other hand, I found coding very exciting. During my first week at university doing my Computer Science degree, the world of Java stressed me out. I must say I found it challenging to think like a programmer. I felt like a tourist in a new country and was finding it difficult to communicate! It was hard to articulate my needs, but I decided that I cannot let programming languages defeat me- I took on the challenge and practised in my own time. Since that day, I have learnt a lot on the job and am proficient in three different languages; Java, C# and Javascript.
Being a test engineer, I felt it was vital to understand the code too, because we work with design principles, design decisions and architecture. To understand how software is developed and delivered helps me get better with testing, therefore having a good knowledge of code becomes essential.
Java
At university, this was a popular language and students were expected to be confident in this programming language. The good thing was, it wasn’t too scary and I managed to pass my degree with good grades.
C
When I was working at Transport for London, the practice decided to move away from manual testing to automated testing. Everything had to be automated in a language that was ‘~#%&£$’ in my head called C#. The support of my colleagues, research, and practice on my own helped me immensely. Within 6 months, I was able to confidently write BDD tests in Specflow with minimal supervision.
Javascript
At Scott Logic, my client required manual tests written for their front-end financial application. As a Test Engineer, I have always been an advocate for automating tests, as they vastly increase your test coverage and improve software quality. This is the beauty of learning languages! You start to see new ways of improving things. I worked hard to showcase my automation skills and write tests in JavaScript with the Nightwatch framework. This reduced the workload of the testing team and subsequently improved overall productivity, with the team having more time to focus on other important things. It was a win-win situation.
Eureka Moment
I am sure many of you have been in similar situations, running away from code when it looked too scary! Or even attempting to learn a difficult language like Mandarin! But worry not, there are ways to combat your fears. Be a warrior.
Let’s start with the vocabulary. It Is very frustrating being a part of a project where you are unaware of the basic vocabulary or programming language. I would suggest that you start gathering information, reading up and more importantly practicing the vocabulary such as; loops, functions, variables, classes and Objects. It’s like learning the first couple of words and greetings in a new language such as ‘hola’, ‘adios’ etc. The aim is to create and manipulate a state and behaviour according to the requirements.
Now that we have grasped some basic vocabulary, what’s next? Turning the vocabulary into a sentence or conversation. Let’s stitch it all together:
Not only can we create complex programs, but we can also use a language to allow communication between databases and APIs interfaces. Sometimes there are foreign statements or sentences for example, at an airport, you may see words like ‘exit’ or it’s Spanish equivalent ‘salida’. You may not be familiar with the word, but you may get the context of the word. When I landed at an airport in Italy and read the word ‘uscita’, it was quite obvious to me what it meant. This applies for coding too, for instance when I create a new variable and assign a value to it; in C# var a = “some string”; or in javascript var a = “some string”.
Hello world in Java and Hello word in Javascript:
The last step would be to become a fluent speaker, coder or someone who needs minimal supervision. This is achieved by ticking off vocabulary and stitching it all together. Now you can generate something according to your knowledge and expertise of the language. You would be able to write efficient code with great design patterns in mind.
Similarities between spoken language and programming language
Firstly, both benefit from careful reviewing and reworking. For instance, in programming, this is known as refactoring. When writing a document or a letter, reviewing and re-working is called editing. With reviews and re-working we are constantly improving the skill level of whatever language you are learning.
Programming languages are extremely strict and consist of subsets of English. Think about it, whether it is Hindi or Python, both languages are used to convey something.
The main concepts in linguistics are known to be syntax and semantics. Syntax expresses a set of rules to allow one to arrange and combine words and phrases, while semantics refers to a piece of information connected to a certain concept. Combining both you achieve a fully functioning expression. So if we think about a programming language, it’s written with some intention (semantics) that follows rules and logic including functions and methods which are the syntax.
Differences
Morphology is the study of words of the human languages, the different formations, relationships and context. There are no analogies or historical and cultural references. When it comes to programming languages, they do not support this yet. So, in human language, I can use a phrase to explain something to a multitude of aspects, whereas in coding I need to explicitly detail each facet of what I am trying to achieve. For example, one day if I mention the word Diwali to someone, they would immediately have some idea about this festival, but when it comes to coding my definition of Diwali via objects and variables it wouldn’t mean much to the poor computer!
With coding, strict rules apply. There is no room for improvisation or imperfections like dialects, slang and typos that still convey the message ‘ttyl’, ‘EOD’.
Human language consists of logical and emotional communication. When speaking it we involve body language, volume, facial expressions which make us all unique. None of this can be applied to a programming language. Nonetheless, masters of code do tend to have their own styles, but this is always in line with logic: precise, perfect and unambiguous.
Conclusion
Understanding the differences and similarities between human languages and programming languages is quite valuable as it aids in generating tools to understand humans with the help of code. For example, tools for speech recognition, grammar checks, Google translate, and Siri. They take a sentence in English and process it so it can be understood by a computer.
Once you’ve learnt one foreign language it becomes slightly easier to learn and understand other similar languages. It’s the same for programming languages. If you know the fundamentals of one language, it serves as a reference to code in another language.
I hope my experience and examples above have given you a good comparison of both human and programming languages. Don’t ever feel overwhelmed with programming, it’s just another language: or ; a ‘techy language’ to communicate with your team. Also, no one’s perfect, es una cuestion de, bereitschaft und tranieren per imparane qualcosa di nuovo.
(Also, no one’s perfect, it’s a question of practice and willingness to learn something new)