This article contains affiliate links. See my affiliate disclosure for more information.

Exposure to multiple programming languages accelerated my growth as a coder.

It gave me a toolset to express a problem in multiple ways and compare and contrast different approaches. This didn't immediately make me a better coder, but it set the stage for some significant shifts in thinking later in my career.

Learning multiple languages changed how I think about API design, taught me the value of a rich type system, and fundamentally altered how I think about data representation.

So let's talk about how to approach learning a second programming language.

This article was originally published in my Curious About Code newsletter. Never miss an issue. Subscribe here →

Picking a Second Language

During my first three years as an undergrad, I learned C++, Java, and C — in that order. Of course, there were challenges, but the syntax and program structure similarities made learning each language progressively easier.

Don't have the bandwidth to learn all new fundamentals? Pick a language similar to the first one you learned.

On the other hand, the languages that have had the most significant impact on me as a coder have been the ones that challenged me to approach problems from a different point of view. Python did this to me. So did SQL.

More recently, Rel — a declarative modeling language in the Datalog family I'm documenting at work — has me rethinking everything I know about data representation.

Want to push your boundaries or challenge your existing ideas? Learn a language that is fundamentally different from your current language.

Ultimately, which language you pick depends on your goals. For example, you may choose a language based on its utility in your current role or to expand the number of jobs you're qualified for.

Or you could do it for fun, which is generally my preferred reason to do anything.

Practicing A Second Language

If you want to gain fluency in a language quickly, the key for programming languages is the same as human languages: immersion.

But I no longer have the stamina I had as a student, nor the excess energy I had before becoming a parent. I don't have time for immersion. I need short, focused, and practical techniques that I can do in a few hours each week.

Consistency is key. Experiment with different learning aids and exercise templates to find a time-efficient and optimized mix for your needs. Just 15 minutes a day can work wonders.

Here's what works for me.

Use Flashcards

The concept is old-fashioned, but whether you use a digital flashcard system like Anki or make your physical cards, flashcards are a simple and convenient way to quiz yourself when you have a few moments to spare.

I make flashcards for:

  • Short code snippets or patterns that are used often
  • Built-in functions and methods
  • Standard library modules
  • New terminology
  • Common terminology that is used differently

I still prefer to make decks of physical cards. I like to use small, blank 3" × 5" index cards that fit in my pockets. They're great for getting in a bit of practice during life's dull moments.

Type Everything Out

One of my favorite exercises is to find a well-written codebase in the new language I want to learn and type out code snippets from it. Social media and chat servers are great places to ask for codebase suggestions.

I pick a function, class, or module — usually 20 lines or less — put it in a window next to my code editor, and start typing it out. As I type, I use comments to take note of things I don't understand. Then I'll mull over the code, research questions I have, or even translate the code into a language I'm more familiar with if I have time.

I like the exercise because it forces you to:

  • Practice reading the new language.
  • Practice writing the new language.
  • Connect new knowledge to existing knowledge.
  • Expose yourself to knowledge gaps.
  • Expose yourself to alternative approaches.

You can complete it in an hour, and it packs a punch.

Document Your Progress

This is the most important advice I have:

Keep a private journal or write in public on a blog. Don't worry about the quality of your writing. Instead, focus on documenting your current understanding of things. Write concept guides that explain how a concept works and why it is important. Make cheat sheets. Keep a file of interesting code snippets with short explainers.

Write. Write. Write.

Writing isn't just a form of communication. It's also a tool for organizing, shaping, and even changing your thoughts and ideas.

I don't consider my understanding of a concept complete until I can explain it in writing in simple, clear terms. This never happens on the first try. I can spend months — even years — refining things.

Here's an easy way to start.

Pick a topic you learned recently and answer three questions:

  • Why is the topic important for you to know?
  • How is the topic related to things you already know?
  • What don't you understand about the topic?

Then describe the topic in five sentences or less. File the document away somewhere and return to it a few days later. Underline any parts of your description that confuse you or that you aren't satisfied with.

This five-sentence description becomes an external representation of your mental model for the concept. Your mental model improves as you revisit your description and refine it over time.

Dig Deeper

Whether you're learning a second language or learning to code for the first time, it helps to have support. All Curious About Code subscribers are invited to join the private Curious About Code Discourse server free of charge.

Subscribe now and join the discussion!