Programming and Foreign Languages

These two are so different! Or are they? Let’s find out how studying human languages can be similar to learning to code, and how it can help to get started with programming.

In recent years, programming has become one of the essential skills for many fields outside of software development: natural and social sciences researchers, public relations and media specialists, business analysts — people of all trades can benefit from learning to code and augmenting some of the daily tasks with self-built computer programs. This might help with daily routines, or maybe become a breakthrough point in your career, who knows? But most importantly, a successful launch of a program gives an undoubtful feeling of achievement.

For the folks who aim to get into software development and IT, learning to code is crucial: even if you are not planning to program on a daily basis yourself, understanding what the team is currently working on is still beneficial and will make you a better manager. However, one of the biggest problems with “learning how to program” is — where to start? Simple yet mind-boggling, this question, if asked to Google, usually returns us a load of opinions, courses’ and boot camps’ ads, and verbose coding gurus’ “incredible” advice like “just start a project idk”. It can be hard to separate the wheat from the chaff.

This post is an attempt to look at the process of learning a programming language from a probably more familiar perspective: learning a foreign human language. It’s not an ultimate guide or a set of directions, more like an impression and a mold of the mindset that helped me personally at the very start of this never-ending journey and that I lean upon today.

Differences and similarities

Of course, any type of comparison should be taken with a grain of salt, so before we dive into analogies and metaphors of the learning process, it makes sense to distinguish between the two and touch upon some fundamental concepts you’ve probably already heard of. But hey, it never hurts to take a different perspective, right?

It makes sense to start with differences. First things first, compared to human languages, programming languages have no native speakers.

Some brows may have been raised. What about the computer itself? For good or worse, computers are not that smart yet to “think” in a form close to humans.

For a computer, all the awesome applications people write are but flows of direct commands, zeros and ones.

We can say that a programming language is somewhat closer to a pidgin — a tool of communication between two parties that simultaneously has features of their languages, but native to none. Usually, in a pidgin, the mixed languages contribute to different aspects unequally: one gives more to the vocabulary, while the other lends its grammar.

In the case of programming languages, continuing this analogy, human-understandable words constitute the language’s vocabulary, while the “grammar” and the logic for organizing it, is a compromise between the human and the machine, determined by human genius.

Basically, any programming language pursues more or less the same goal: to give the computer precise and effective instructions, while staying understandable and maintainable for humans. It is worth noticing that control over the machine and convenience for humans are the two points programming languages balance between. The more control we want (for example, if we need to precisely allocate the machine’s resources in a game engine) the more we need to “think” and write like a computer. The more convenience we want (for example, if we develop a CPU non-intensive but large application) the less control we have over the machine’s resources. Different languages are more or less suitable for different types of software and tasks, being one of the reasons why there are so many. You might have heard about the so-called “high-level” (Python, JavaScript) and “low-level” (Assembly languages, C, Rust) programming languages. The former are sometimes nearly close to the human-speaking languages, so even a non-coding person with some English proficiency can guess what a line of code does; while the latter can look really obscure and alien. It can be said that higher-level languages “cover”, or “abstract”, more machine aspects rather than the low-level languages that expose more. “Abstraction” is a great way of understanding the whole hardware and software architecture of modern computers. I would definitely recommend checking out a wonderful book by Andrew Tanenbaum to get acquainted with this concept in greater detail.

This entails the second major difference: unlike human languages, programming languages are almost purely imperative and nominative. Unfortunately, we can’t use Java or Python to ask a computer “To be or not be?” or “What is love?” (but we can use them to write a program that would try to answer these questions coherently though!). “Do this, don’t do that”. “If this happens do that one instead”. “numberis 5, and nameis 'John Doe'”. - those are the typical directions we form with a programming language to tell the computer what to do. When we run our program, the lines of humanly-understandable code become “computerly-understandable” flows of directions with the help of special software that "translates" our code for the machine, or "teaches" it to interpret it directly.

“Translates”, you say? Here we are starting to get closer to the similarities. While being a bit of a stretch, we can say that kin to the languages we speak, programming languages can be translated.

Like we’ve noticed earlier, computers are not “smart” enough to learn and speak languages directly, as we, humans, do. To put very roughly, the code we write needs to be consumed by the computer before it runs. And also, we remember that programming languages can be aimed at different tasks and vary from the abstraction point of view. This is reflected in two groups of programming languages: interpreted and compiled.

The former group can be understood and run by a computer on the fly, if the special software (or, a set of software) called “execution environment” (also known as runtime environment) is installed on the machine. We can say that the process is similar to simultaneous interpretation: thanks to the runtime environment, the machine is ready to take commands and execute them immediately. JavaScript and Python are great examples of interpreted languages.

The latter group, the compiled languages, need to be “translated” into the less abstracted code the machine can understand. In this case, writing and running a program becomes a bit more complicated, but compiled languages are usually less error-prone since the compiler program helps to check for possible errors before creating an executable file. C, C++, C#, Java, Kotlin are all compiled languages.

Besides that, another process that can be linked to “translation” is transpilation. If the compilation process involves translating code into less abstract code closer to the machine, transpilation involves translating one language into another at relatively the same level of abstraction. Why this can be useful? Usually, it is a matter of convenience. A typical use case would be that some languages, like JavaScript, are quite suitable for an individual developer or a small team to work with: they don’t require to be compiled and the results can be seen immediately. However, developing and maintaining a larger project can become tricky, as the developer tools are less strict than the ones in the compiled languages (even though there were some tremendous changes to the JavaScript ecosystem in recent years). JavaScript is the language powering most of the interactivity of the web-pages on the Internet, and in web-development, it cannot be avoided completely. That’s why some teams and individual developers prefer to use other languages in development, like TypeScript or C#, and then transpile them into JavaScript.

So, these languages can be translated into one another? Maybe they are not so different after all? That’s right, and it brings us to the next point: carryover.

Apart from obvious aspects, most of the human languages have some similarities with the languages within the same group or some common vocabulary with their neighbors. If you are an English speaker, you hardly can say that basic German is something completely alien to you, and vice versa. Or if you are a Slavic language or a Turkic language native speaker, you probably won’t have a too hard time reaching at least some mutual understanding with speakers within your language’s family. Chinese characters give you a superpower of understanding at least a title and main topic of a text if it uses them even if the languages are fundamentally different, be it Chinese, Japanese, or Korean (the latter uses them quite rarely though).

If we have this wonderful phenomenon with wildly rich, complex, and vivid languages of humans, what else to say of the programming languages, strict, artificial, and human-regulated? A good understanding of one programming language opens doors to many others: the syntax and best practices may be different, some quirks to be adjusted to, but the overall logic and skills (understanding of variables and loops, knowledge of algorithms and data structures, determination and ability to write effective, maintainable code) can be used in any other language.

The next point is quite simple, just like people compose incredible pieces of literature and poetry, both fiction and non-fiction, with the languages they speak, programming languages can be used for and aimed at creating awesome things. Computer programs are a beautiful blend of profound knowledge and deep determination, personal hard work and superb team play, logic and inspiration, individual creativity and humongous collective efforts by thousands of people.

And last but not least, and this one is purely subjective, programming languages are suitable for humor. As weird as it may sound first, believe it or not, but lines of code can sometimes outshine a comedy show, and all you need to see is a couple of snippets. So if your favorite standup comedian’s jokes run dry lately, programming is sure to bring a spark to your life perspective. So even if Java or Python are not direct means of human-to-human communication in the first place, we still can use them, consciously or unconsciously, to convey jokes and share a good laugh.

I may or may not convinced you that programming and human languages share some traits, but if you’ve read so far, let’s dive into the biggest point of similarity in my opinion: the learning process.

¡Hola!

Usually, before we start learning a foreign language, there should be a certain spur of motivation. We might accidentally listen to a beautiful song whose alien and mysterious lyrics charm us. We can watch an interview with an international movie star speaking her or his mother tongue and dream of having a conversation with the idol ourselves. Or we can discover that in the next couple of years proficiency in a certain language guarantees a fat check! How about learning the language of one of the ancestors? Or just for fun, charmed with a certain sound or feature?

It is not the enormous grammar tables that keep us motivated, it is the result, the ability to use the language.

When it comes to programming languages, I would suggest starting from a somewhat similar point: take a look at some nice pieces of software out there and make a little research, which languages do they use? Are you fascinated with the functionality of some Android app? Maybe you should take a look at Java and Kotlin! Or you are a big fan of Apple products and want to have your name under some of those neat applications in the app store? Then you are lucky to have that cool MacBook of yours, since it provides excellent support for Swift, the primary language for building applications for all the Apple devices. Or maybe you have a large research project that needs some serious analysis? Then maybe you should take a look at possible usages of R and Python! A million-dollar website idea? Easy take for HTML, CSS, and JavaScript combo. Or maybe you are a hardcore DIY engineer who cannot wait to automate everything with something like Arduino boards? Then maybe you should take a look at low-level languages like C/C++ or Rust to create fascinating embedded programs!

Just like with a foreign language, in most cases, it’s not the enormous grammar tables or the traumatizing listening exercises that keep us motivated and excited. It is the result, the ability to use the language. To listen to music, to read books, to conquer business meetings. The same goes for learning a programming language. The process of learning might (and most likely will) be tedious and discouraging. But the result, the incredible applications you will build, the beautiful websites you will develop, or amazing and in-depth analytical tools you will master — those are the things you should remember and aim for.

Try and watch some amazing things made possible with the power of programming. Read about the technologies involved. Take it seriously, but don’t overthink. Compare the thoughts and opinions of other people, but don’t rush to become opinionated yourself.

A good idea would be saving interesting links in a dedicated bookmark folder. I would also suggest having a small notepad for your thoughts and impressions. Write down these mysterious acronyms you are about to encounter, it will be great fun to return to your notes later on.

With this inspiration — take a deep breath, you’re going to pronounce some first “Hello world” s!

Écoute et répète

As we start with a foreign language, a good idea would be to try and say some first words. Heavy accent, hesitated, and sometimes ashamed even if there’s no one around, we switch on some podcast or an audio course, and repeat after the teachers.

Find some simple tutorial videos (the best option would be a crash course or a super small project). If you have access to YouTube, it is a gold mine of great tutorials. Ask simple and short: “Guide on Python”, “JavaScript crash course”, “What is C++”. There certainly will be some high quaility and nice videos waiting for you to discover. I would suggest going for ones that are practical and well-done on the production level, with less immediate results promises and clickbaits (“Learn C# in 5 minutes with this simple technique” is probably not the best choice).

Prepare some “pencils and paper” — an editor or a recommended IDE for the language you’ve decided to start with, a good author would usually suggest some links or shows how to set up some basic environment, and then: watch, repeat, rewatch, repeat again. Listen carefully and make some notes. Don’t worry about understanding everything at once, but write down carefully and explain to yourself what you are doing: assigning values to variables, declaring and calling functions.

At this point your goal is not to learn by heart everything you’ve encountered: you need to get comfortable with saying your how-do-you-dos (or, hello-world’s) even if you don’t fully understand what is going on step by step.

Don’t copypaste, follow along, and stop the video if you need it. You’re not in a rush.

If you’ve logged into your Google account, at some point your feed is going to be filled with more and more suggestions on your language of choice and programming as a whole. If you’ve liked the explanation style of a certain YouTuber, follow him or her, discover some playlists and links under the videos, your bookmark folder is about to explode with useful pages.

When you get your first words uttered with the help of a phrasebook, congratulations, you’ve made your first steps on this great road! It’s time to start diving deeper.

Grammar book time!

Just like with a foreign language, the best tutor and the best course won’t be much of a help, if you don’t blow the dust from that thick grammar book.

Don’t take it literally, though: unlike with foreign languages, buying a printed book is not always the best decision. A much better choice would be one of the websites you’ve probably already bookmarked.

Every major programming language usually comes with an official documentation platform and several unofficial but nevertheless great websites. Many of them come with an in-browser editor that allows learning some basics of the language without going through setting up the whole environment. Moreover, it can be a great way to practice when you don’t have access to a full-fledged computer. The knowledge you get is not going anywhere.

I would suggest going through the official tutorials and start studying documentation. Take notes along the way, and, once again, don’t copypaste the code: writing it yourself is going to be much more beneficial.

Another great skill to pick up at this point is a habit to write down unclear parts and Google them. If the question is asked correctly, the result will usually give a list of Stackoverflow topics and articles on your question. Don’t forget to bookmark useful links and re-organize that “library” of knowledge, so you know what topic can be found where, and what links you’d better read or re-read in a spare time.

And don’t feel like cheating when you search for stuff. You are not an imposter, you are a cyborg. Well, to a certain extend. To my experience, scramming to learn by heart is not the best tactics in the long run. In most cases, it would be enough just not to copypaste the code, but re-type it instead. Explain what you’re writing along the way: use code comments and your own voice. Take a look at the code snippet and speak out loud, what are the lines of code doing. How would you explain it to your peers? To your best friend? To a child? Try out different explanations with your wit, especially on those harder and tricky points. Repeated this way, the hardest concepts will come naturally to you.

Getting some of your friends involved can be a good idea sometimes. It would be better to not push all of your mighty knowledge too much on them, but you’re learning some fascinating stuff about the world around you, so why not share it?

Magnum opus

So far you’ve probably been developing some tutorial projects for some time, and now the time has come to build something of a larger scale! A Magnum Opus, if you will.

Personally, I believe that a project-based approach is the greatest way to learn. Moreover, it usually looks good in your resume. I hope you remember what inspired you to learn your language of choice and the technologies around it. It is probably the right time to set a more concrete goal and start (or continue?) making a list of technologies that are likely to come in handy in your project: frameworks, libraries, databases. I usually make a set of to-learns with corresponding bookmarks.

As you get into working on your Magnum Opus, it would be a good idea to work on a larger scale, yet guided project to fortify the knowledge you’ve gained so far. The greatest literature authors in history were great readers before everything else, weren’t they?

You can do it in parallel to finding out technologies for the project of your own. A well-structured large study project will show you some best practices and help you to discover new technologies. What’s more, it will definitely force you to dive deeper into the parts of documentation you’ve skipped or preferred to skim through (and it does happen a lot to everyone: the temptation is real).

You may choose some of the larger project tutorials by your favorite YouTubers, or find a project-based online course with good reviews, or find some separate tutorials that are connected to the topic you’re interested in. With the help of the authors, you will feel confident about what you’re doing and have some new ideas for the personal project of yours.

The more you read, listen, write, and speak the more eloquent of a speaker you become. The more you read and write the more of a better programming language user you become. Practice, express yourself, and get better with every coding session. And don’t forget to take a look at some early notes after you set up your Magnum Opus: it will surely bring a smile to your face.

Hope I’ve managed to inspire you a little bit if you felt hesitant to start, or felt down because some tough concept has been irritating you for a while. You will make it, no doubts. After all, all the languages we use and create, be it humanly-spoken or programming, are tools that serve the same purpose — to create new things and express ourselves.

Good luck to you on this wonderful journey!

Cheers!

This article was originally published on my website. There, I publish and translate various articles and tutorials. Feel free to check it out!

Full stack developer & Translator