Foreign Languages and Programming Languages: What Do They Have in Common?
In thinking about the relationship between these kinds of languages, I thought about whether Chinese speakers — or speakers of any language other than English — write code in English.
My first exposure to a programming language was Python in a computer science course while I was an undergraduate student at UC Berkeley. When I was first introduced to coding, I started out by learning the fundamentals: What is a variable? A conditional? A loop? I learned the building blocks of programming — how to tell the computer to perform certain actions.
When I started learning a new programming language, the process was entirely different. At Flatiron, the first language you learn is Ruby. As with Python, we learned the fundamental concepts and actions — again, variables, conditionals, loops, etc. Both Python and Ruby are built upon the foundational concepts of computer science.
The actions they convey are the same, but the way they are expressed is different. Although I am at the very beginning of understanding what makes a programming language distinct from the others, I am beginning to understand what learning new languages will be like as I progress in my career as a developer.
Around the time I first saw code in college, I also started learning Mandarin Chinese. Like computer science, Mandarin was completely outside of my comfort zone. I neither considered myself a math/science person or someone particularly gifted at languages.
Mandarin was attractive to me because it was so entirely different from anything I already knew. I was intensely curious about the language and about China, which seemed about as different from the U.S. as I could imagine. Mandarin certainly couldn’t be any more different from English.
Because I discovered coding and Mandarin in the same moment in my life and because both cause me to teeter between profound joy and utter frustration, I have been interested in the relationship between learning programming languages and learning foreign languages.
Although learning to code and learning to speak Mandarin have been, at their core, very different experiences for me, I have observed some parallels. If you have studied a foreign language, vocabulary lists and grammar drills will be familiar to you.
If you’ve made it to proficiency in a foreign language, you know that when you know enough vocabulary and grammar patterns you can combine them to express yourself — to convey ever-more-complex ideas that you normally would express in your native tongue.
Language is modular, and so is coding. Writing code is really just combining sets of expressions or instructions into larger and larger components of software to eventually make up one application.
The modular nature of language is especially true with Chinese. In Chinese, radicals are the basic graphical components of the language. They each have their own meaning and combine together in a Chinese character to form a composite meaning. Chinese words are composed of one or more characters and these sets of characters together form full sentences and expressions of ideas.
All of these words include the radical for hand (pronounced shou), which relates to their meanings.
In thinking about the relationship between these kinds of languages, I thought about whether Chinese speakers — or speakers of any language other than English — write code in English. Of course they do.
Most dominant programming languages use Latin letters and English words. Variables are defined with the words “var,” “int,” and “string” and procedures like conditionals and loops with words like “if” and “while.” What would the experience of learning to code be like if you did not know English first?
So why is it that most programming languages are in English? First of all, over one-third of the 8,500+ programming languages were created in English-speaking countries. Even dominant languages that did not originate in English-speaking countries like Python (the Netherlands) and Ruby (Japan) were written in English to accommodate an international audience of developers.
As in other areas and industries, English became the common language. With that said, there are many examples of programming languages written in languages that are not English, and many code bases around the world will have comments written in foreign languages even if the code itself is in a programming language rooted in English.
Knowing that the world of software engineering may be another product of Western centricity, a remnant of imperialism, I am disappointed.
I believe that software engineers should be able to write code in their native language as a point of both pride and comfort, and perhaps more importantly, that learning to code should be accessible to anyone, regardless of their comfort with English.
In reality, I’m not sure how international developers feel about the issue, but from reading a couple of Reddit threads, it seems that non-English-speakers just view the English words in programming languages as neutral keywords.
There is also something very beautiful about programming languages serving as a common mode of communication across the software engineering community all over the world. In many ways, programming languages have become a common mode of creation and communication that transcends cultures and borders, symbolizing that creating software is universal for all humanity.