How learning a foreign language helps you learn to code
By: Dylan Attal
Tags: Programming, Coding, Foreign Language, Tech, JavaScript

The road to becoming a software developer is a long and difficult one, especially for individuals like me who come from a completely non-technical background. I am a communication-oriented person. I have a passion for speaking foreign languages, immersing myself in foreign cultures, and trying all sorts of new food.

I am a humanities guy. A liberal arts guy. How did I learn how to code? My obsession with foreign language had a lot to do with it.

I grew up in Tampa, a beautiful city on the west coast of Florida with a rich Hispanic heritage. My ancestry is Scotch-Irish and my parents moved to Tampa around 30 years ago from North Carolina. My father worked in the famous Columbia restaurant where I remember eating chicken and yellow rice while watching flamenco shows at a young age.

Flamenco show at the Columbia Restaurant. Impressive and intense. Credit to columbiarestaurant.

Many of my friends in school grew up bilingual. I heard them speaking Spanish with their parents at pick-up time. It always fascinated me how they could communicate between themselves without me understanding. It was a certain power I didn’t have. It was like magic. Moreover, my best friend was Brazilian. When he spoke to his family in Portuguese, even my Spanish-speaking friends couldn’t understand. I remember promising myself in the 6th grade that one day I would be trilingual. My dream was to wield the magic of language.

Fast forward about 15 years.

I had accomplished my goal. I studied Linguistics, Spanish, Portuguese, Latin American Studies, and Teaching English as a Second Language at the University of Florida (GO GATORS! 🐊). I spent time in Sevilla, Barcelona, and Rio de Janeiro during my language studies. As a post-graduation trip, I hiked up Machu Picchu in Peru.

My knowledge of foreign languages opened up so many doors for me. I connected with people from completely different cultures, regions, and perspectives. I chowed down on local delicacies: alpaca burgers, cow hearts, fried guinea pig, seared rabbit, roasted chicken hearts, and more.

Brazilian chicken hearts. SO GOOD. Credit to Brazilian Chef.

But ultimately, I decided not to pursue a career in foreign language education like I had planned. The reasons behind that decision are many, and for a different post entirely.

I ended up as a software developer, and I couldn’t be happier. However, there was a lot of self-doubt along the way because I made such a leap career-wise. As it turns out, though, learning two foreign languages in the past greatly benefitted me as I learned how to code.

I argue that anyone who has learned a foreign language is uniquely suited for learning how to program. There are a lot of similarities between learning a human language and a programming language. I think that these similarities can be boiled down to two main points:

The learning process The learning mindset

The Learning Process

The processes through which you learn a human language and a programming language are remarkably similar. You have to pass through similar steps in the same order to learn them effectively.

Step 1: Learn the Building Blocks

When you’re learning a foreign language, you start with memorizing vocabulary words. Vocabulary words are the building blocks of the language. You learn the words that are used most often and the words that form the basics of the human experience: names, numbers, colors, family members, days of the week, months of the year, etc.

You don’t know how these words fit together, but you learn them and their definitions. You may even sing songs or chant them in order to memorize them.

In programming, there is a similar step. How does the language handle numbers? How do you perform operations on those numbers? How do you declare a variable and store its value? How do you write, “Hello, world”?

Step 2: Put the Blocks Together

The next step in learning a foreign language is putting words together. There’s no real understanding of grammar yet, but you start to understand that words go together to create more complex meaning.

For example, Me llamo Dylan means My name is Dylan . At this point in my journey in Spanish I wouldn’t understand that me is a reflexive pronoun that is attached to the verb llamarse , and I wouldn’t understand that llamo is the first person present conjugation of llamarse , but I would know that the way to say your name is to say the phrase Me llamo [name] .

Similarly, while beginning to learn JavaScript, you may not fully understand why the following code is written how it is, but you’ll understand that it returns the values in the array less than 50:

let prices = [25, 30, 80, 90, 100]

prices.filter(price => price < 50)

// returns [25, 30]

You could have written the above code differently. I didn’t have to write it with an arrow function. But at this point, those kinds of subtleties aren’t the most important thing. The most important thing is realizing that you can manipulate arrays through functions.

Step 3: Learn Syntax

This is the turning point in language learning. This is where you learn how to construct meaningful ideas by using grammar to string together ideas. You learn how to conjugate verbs. You learn the difference between tenses. You learn purely functional words — words that don’t really mean anything on their own, but help us connect phrases and ideas. The Spanish word que is a good example. It is often used as a subordinating conjunction, a word that connects clauses together.

Grammar is a hard part of learning a new language because it is more abstract than learning words that have real-life references. mesa in Spanish is table . That’s easy to picture. ni siquiera is a phrase that means not even , like “I wouldn’t date him not even for a million dollars.” How do you picture the idea of “not even”? But it’s an important connector put into a specific place in the sentence to determine a relationship between the desire (or lack thereof) to date him and the idea of one million dollars.

My favorite example of learning syntax in programming is this in JavaScript. It’s a confusing topic at first. Why are we writing this before function calls? What does this mean? Why is it called this ? Keywords like this are the grammar of programming. this accesses the context object in which the current code is executing. It don’t necessarily mean anything on its own, but it helps us connect parts of our code.

It’s worth mentioning that grammar varies wildly from one human language to another. That goes for programming languages, too. Just imagine the differences between object-oriented languages and functional languages. Also strongly-typed and weakly-typed languages. They look and act differently.

Step 4: Speak Like a Native

At this step you can get the message across, but it sounds weird. People can tell you’re not a native speaker. Maybe you have a heavy accent. Maybe your grammar makes sense logically, but it’s just not the way people would normally express the idea.

Working on this step is the most rewarding but also the most difficult. Language students pride themselves on sounding native. Your accent is a big part of this, but there are a lot of other things to keep in mind. Using idiomatic phrases is one. Word choice is another. Register — when to be formal, when to be casual, when to be vulgar — is another complicated part of sounding native.

When I was studying abroad in Rio de Janeiro, my host mother was showing me around town on the first day. I lived in Copacabana three blocks from the beach. I was thinking how beautiful it would be to watch the sunset from the beach, but I didn’t know the word for “sunset!” So I asked instead, At what time does the sun disappear? Horribly formal, very stilted way to ask about the sunset. But the way I asked was completely grammatically correct, so she shot me a weird look and answered. Then politely provided me with pôr-do-sol as the word for sunset.

Sunset over Copacabana beach in Rio de Janeiro, Brazil. Credit to Shutterstock.

Coding is the same. You have many options (in some languages more than others) to express an idea. There is a creative — maybe even artistic — side to coding due to the flexibility with which you can accomplish your goals.

But sounding native in code is important, too. I learned early on that your code should be readable by other developers. No one wants to read code that is improperly indented or where there’s weird unnecessary whitespace. People want logically organized code. People want variable names that make sense. People want helpful comments.

Similarly, following conventions is important. Can you use div s to make headers and footers for a page? Yes. But why would you? HTML5 gave us header and footer tags to help with SEO, accessibility, and readability of code by other developers. If you continue to use div s, the code will execute fine, but people will raise an eyebrow at it.

The Learning Mindset

It takes a certain mindset to excel as a language student. You have to be childlike: hungry to understand the world around you, willing to accept new information as you discover it, and unafraid of making mistakes or looking silly.

Learning a foreign language is frustrating because you have to learn certain basics or rules of the language then later find out that there are a ton of exceptions to those rules. For example, in Spanish you usually put the adjective after the noun. So pretty woman would be mujer bonita , where “bonita” is “pretty”. This is awkward for English speakers learning Spanish because in English you generally put the adjectives before the nouns.

As it turns out, though, there are plenty of instances in Spanish where the adjective goes before the noun! In fact, some adjectives you can put either before or after the noun, and the placement changes the meaning of the sentence:

Mi amiga vieja // My old (in terms of age) friend

Mi vieja amiga // My old (you have known her for a long time) friend

A successful language student is able to work through the frustration that comes along with these paradigm shifts. Instead of thinking, “What do you mean adjectives can come before nouns?! What a waste of time! You should have told me that in the first place!” they would say, “How interesting! So it turns out that there are instances where an adjective before a noun adds nuance to the sentence’s meaning. I’m glad I learned the general rule first and then the exceptions so I didn’t get confused.”

A good language student does not seek to understand a language all at once. They realize that it’s a constant practice. And furthermore, the understanding of a language is a moving target. Languages are constantly changing and evolving. As a language student, you have to accept that standards and conventions are constantly changing and you have to keep up to date with them.

You need a similar learning mindset when learning to program.

When I first learned how to iterate through arrays in JavaScript, I did so with a for loop. That was the only way I knew how to. Later on, I discovered .forEach() , .filter() , and .map() . Those blew my mind at the time! Even later I discovered .every() , .some() , and .reduce() . It turns out that there are many more ways to iterate through arrays than I originally knew, but I built my base knowledge of iteration with for loops, then added to and modified my understanding of iteration as time went on.

Just as human languages evolve, so do programming languages. I have heard a lot of developers complain about having to learn new frameworks every several years. I don’t understand the complaints. New frameworks often make using the language easier. It’s our job as a software developer to stay current on the best practices and new trends within programming languages.

Software developers also have to stay up to date with the release of new language versions. For example, with the release of ES6 JavaScript, arrow functions became (deservedly) popular. Oftentimes, they make code easier to read and write. Why stick with ES5 syntax when there is a better alternative? It doesn’t make sense to be stuck in old ways.

Perhaps the most important character trait in a successful language learner is the ability to make mistakes.

Fear holds us back from learning. Fear of failure. Fear of looking stupid. Fear of not measuring up to expectations. Fear of making mistakes. So a lot of people keep their mouth shut. They figure that if they don’t talk in a foreign language then they can’t make mistakes. This is, of course, a poor strategy since the crux of learning a foreign language is speaking.

I think that this is one reason that children are such good learners. They’re not afraid! They make mistake after mistake and don’t feel ashamed. They say nonsensical things all the time. They blabber. They make up words. They tell stories with no clear purpose or plot. They experiment. And through all their mess-ups and trials and errors, they discover the accepted patterns of their native language.

It’s much harder for adults to adopt this mindset with a second language, but I believe that if you learn how to laugh at yourself you can take the sting out of mistakes and enjoy the learning journey.

I remember the summer I studied abroad in Sevilla, Spain. I had just begun to take learning Spanish seriously. I was so excited to be in the beautiful south of Spain, but boy was it hot! And I’m from Florida, so that’s saying something!

One night I was walking home from a bar with a group of Spaniards and some American friends. We were all sweating it was so hot even with the sun down. I had had enough, and I exclaimed ¡Dios mío, estoy caliente! which translates to Oh my god, I'm horny! 🤦🏻‍♂️

After a moment of shocked silence they erupted into laughter. What I should have said was ¡Dios mío, tengo calor! . It’s a common mistake among English speakers learning Spanish. I was embarrassed, but I was laughing as hard as they were once I realized my mistake. It became one of our favorite stories to tell back home. And trust me, I’ve never forgotten how to say I'm hot since.

Plaza de España in Sevilla, Spain. What a beautiful city. Credit to HandLuggageOnly.

The Bottom Line

Don’t be afraid to learn how to code if you’re a humanities person like me. Many dev teams are looking for people with strong interpersonal skills!

Your background is a double-edged sword. You will certainly have to play catch up, but on the other hand, you are predisposed to learn programming very effectively. And the best news is that you bring a whole swath of soft skills to the table that traditional programmers might not.

Learning a second language can be fun, rewarding, and fulfilling. I found that learning programming can be fun, rewarding, and fulfilling, too. With an understanding of the learning process and the right attitude you can succeed at — and enjoy — both.