Amy M Haddad

How to Retain the Programming Knowledge You’ve Gained

By: Amy M Haddad


There’s a lot to learn as a programmer. And there’s just as much material to remember and recall.

You don’t want to relearn SQL because you haven’t touched it in a few weeks. You don’t want to lose your edge with HTML as you learn about databases.

We want to stay sharp on older topics as we learn new ones. Imagine a simple way to retain what you’ve gained. There is: Anki, a flashcard program.

It’s not just using a flashcard program that matters. But it’s also how you use it.

Get It and Retain It

As programmers, we spend many hours learning a range of programming topics. We need to remember and quickly recall information we've already learned over time. Anki helps us do just that.

At my standing desk this morning I pulled up the Anki application on my computer, and opened my “CSS” flashcard deck. I went through as many cards as I could in ten minutes. Then, I closed it and spent the next two hours building a web application.

Once I finished my work, I pulled up Anki once more. This time I opened my “JSON/Requests” deck, and went through as many cards as I could in twenty minutes. It wasn’t many because I got stuck.

That’s one reason why I use Anki as much as I do: to spot areas that need a bit of work. I also use it to learn new topics. I’m learning JavaScript right now, and I’ll cycle through my JavaScript deck to learn the material better.

However, for me the real benefit of Anki is to keep previously learned material fresh and top of mind. That’s why I intentionally choose flashcard decks that are different from what I’m learning or currently working on. It helps me recall older material as I learn new content.

Space It Out

Anki is useful because of the order the flashcards appear in. It uses spaced repetition.

It's a learning technique where you repeatedly review a topic over time. For example, you may see a new flashcard today. Then, you may see it again in ten minutes, a day, a week, ten days, a few months, and so on.

You influence how quickly you see a card again based on given time periods, which can vary.

image.          The above image is an example of time intervals on an Anki flashcard.

Say you're given a flashcard and get the answer wrong. Or you found it pretty tough and want to see it again soon. If you select '<1m', then you'll see the card in less than one minute.

On the other hand, if you got the answer correct or found it to be easy, you may select a later time interval like '4d' (four days). Four days later, when you see the card again, you may get a different set of time intervals to chose from: such as one week, ten days, or 1.6 months.

The idea is that you're retrieving information over time at different intervals. Challenging cards are shown more frequently than easier ones.

There are two benefits that result from this practice. First, my cards are mixed up in what appears to me as random. That means, I always have to be prepared.

I make a new flashcard deck for each topic I learn, including Git, HTTP, SQL, JavaScript, and Python. I need to be ready to field any number of questions within that particular deck.

In my “Python” deck I might get a card about class variables. Another one about dictionary comprehensions. And then another about generators. You get the idea; I need to be ready for anything.

Second, spaced repetition helps immensely with recall. I continue to revisit topics, albeit at different intervals, long after I’ve learned it. This helps me to stay sharp on previously learned material.

There’s a broader benefit to spaced repetition: it’ll boost your confidence. It’s one thing to recall how to solve a recursive problem when you’re learning about recursion.

It’s another when you’re able to recall it days, weeks, or months later. I admit, I’m not always able to do so, which is why Anki is useful. But over time repetition breeds familiarity, which consequently increases my confidence with it.

Mix It Up

It’s not just how Anki works that matters. It’s also how I use it that makes the practice so valuable.

You’re writing SQL queries this morning, but need to solve a problem in JavaScript this afternoon. You’ve got to keep your edge with multiple languages. You’ve got to quickly recall how to navigate on the command line. In other words, you’ve got to be able to pivot. Used wisely, Anki helps you prepare for that.

This dance between new and old is at odds with how most of us learned in school: linearly. Start at chapter one and move sequentially until you hit the end. Learn everything about this topic, then learn everything about that topic. Get tested on one topic at a time.

This linear approach is problematic for retaining information. I'd inevitably forget nuances of topics I learned about at the start. And, after several weeks or months passed, I'd definitely lose my edge.

As we learn new technologies, we don’t want to forget about the ones we learned a few months ago. We want to retain the information we learned—not relearn it.

The alternative is to interleave the topics you’re learning. It’s when you mix multiple topics or skills together into your practice session.

Instead of focusing on one thing exclusively and then the next, mix it up: practice "several related skills together," explains Scientific American. "A pianist alternates practice between scales, chords, and arpeggios, while a tennis player alternates practice between forehands, backhands, and volleys."

Here’s how you can interleave your programming practice with Anki:

  • Spend the first fifteen minutes of your practice time reviewing your “JavaScript” deck before plowing into your Python problem.
  • After working on a web page for an hour, spend fifteen minutes reviewing your “Git” deck.

The point is, the Anki deck you study should be different from your core programming activity. This will help you stay sharp with previously learned material.

Make it Active

I’ve learned something important about learning: the information sticks when the learning is active. When I use Anki, I’m not passively clicking through cards “thinking” of the answers. Instead it’s an active process.

  • A card asks me to write a SQL query. I pull up DBeaver and write it.

  • Another card asks me to reverse a string. I open my editor, write the function, and run it.

  • And yet another asks me to run a command on the command line. I go to my terminal and type it.

I physically do what the card asks. It’s like muscle memory for my fingers.

Besides, I’ve found that if I just “think” of the answer I’ll rush the process and overlook a detail or two. Taking the time to write the command or line of code helps to solidify the mental model I’m trying to build.

A Small Investment

You spend a ton of time and energy learning some difficult topics. Stay sharp and retain what you’ve learned with Anki. To me, fifteen minutes here and there studying Anki flashcards is a tiny deposit. Small deposits over the course of a period of time can have a big payoff.

Through the lens of programming, that means staying on top of a mountain of material and being able to consistently and quickly recall a vast amount of information.

← back to all posts