Site icon Treehouse Blog

Acquiring Bricks: How to learn code like a foreign language

How to learn code like a foreign language

I had always heard that the grammar and syntax of coding languages were in so many ways like foreign languages, but for me, foreign language courses were much less intimidating than computer science. That drove me to studying Italian in college, which was an impractical choice for finding a job, but I believe it helped me a lot when I decided to learn Swift. This is not to say that you have to be “good at” foreign languages to connect with code, but to present a framework for learning to code that is similar to learning a foreign language (you might find this useful for learning a foreign language as well!)

Learning a Foreign Language

When we start learning a foreign language, right off the bat, we grasp onto things that are directly translatable, like “ciao” for “hello.”  We start learning rules for concepts like different types of pronouns that help us put pieces together: we can say “un cane” for “a dog” and “il cane” for “the dog.”  We learn to conjugate verbs that allow us to make sentences, like “Ho un cane” (I have a dog) and “Hai un cane” (You have a dog).  These pieces act like bricks that we stack to build structures. As we acquire more bricks, we can build bigger and more creative structures.

In the early stages of learning a foreign language, sometimes we want to be able to say something for which we haven’t yet learned the grammar.  On my first day of Italian, I learned to introduce myself with “Mi chiamo Jo” (My name is Jo), but I hadn’t yet learned how to conjugate verbs or handle reflexive pronouns.  I just accepted this phrase as a chunk of language that had a specific meaning, but the individual bricks didn’t yet make sense.

Not understanding the bricks can be uncomfortable (I find it very uncomfortable), but with time, we learn how to deconstruct these structures and use their bricks more creatively in our own structures. We may preference certain patterns and bricks throughout this process and avoid using some all together, but the more times we experience structures, both new and previously seen, the more comfortable we will become with the process of breaking them down into their bricks. Our fluency is the measure of our progress; that is, our ability and confidence to use the bricks and structures (which we might not always fully understand) that we have to communicate in our new language.

Learning a Computer Language

The most significant difference between learning a computer language and a foreign language is the abstract nature of computer languages. I think in English in the same way that Italians think in Italian, so mapping these languages onto each other is natural.  I don’t think like a computer, so the initial stage of learning a computer language has to be different.

We have to accept that we might not understand why we are learning certain concepts or even why they exist.  We can, however, still focus on the bricks. We might not fully understand why we pass bits of information around in variables, but we can learn how to make them and understand the difference between variables and constants.  We can then learn the syntax to use arrays, dictionaries, structs, loops, etc. pretty easily.

When it comes to the bigger structures —like making functions, conforming to delegates, learning things like object-oriented programming—we may have to copy patterns and structures from tutorials for a while as we come to understand them.  This can be uncomfortable, like when I hadn’t yet learned reflexive pronouns but was introducing myself in Italian. However, bit by bit, our fluency will improve until the “aha” moment comes when we understand a new structure and can use its bricks independently in our own creative endeavors.  For example, I really struggled with closures in Swift, but for a while I used them anyway simply by following the patterns I was seeing in Treehouse projects and code snippets. One night, I woke up at 3 A.M. with an “aha” thought, and closures suddenly made sense (true story).

Finding Your Best Resources

At the beginning of my journey into Swift, everyone said the documentation would be my best friend and my first go-to, but I would give different advice for those just starting out.  Just like how you wouldn’t pick up a dictionary written in Italian on your first day of a beginner language class, it doesn’t make a lot of sense to rely on documentation when you don’t yet have a vocabulary for code.  You have to find resources (like Treehouse) that present the information in a way that you can understand. Documentation will be useful to you one day, but until then, look at it with curiosity only to note what you might understand.  Don’t let it make you think you can’t do this because it seems like English (or whatever language you are reading it in), and you just don’t understand it.  Developing vocabulary in your new computer language takes time.

Practice — and Patience — Make Perfect

Just like how I have to practice Italian to increase my fluency, I have to practice Swift or whatever language I’m learning. Being discouraged by my accent and frustrated by my mistakes will not help me become a better coder or Italian speaker. I have to step back, look at how far I have come, and  be patient with the process. There’s always a little I can learn, and the bigger leaps will come as the smaller steps build up.

Joanna Lingenfelter is a Treehouse Techdegree graduate, and currently works as an iOS developer at Mobelux in Richmond, VA. She enjoys trampolines and is an avid fidget collector.

Interested in a guided iOS curriculum that leads you from beginner to job-ready developer? Check out our Techdegree in iOS development.
Free 7-day Techdegree Trial

Exit mobile version