DEV Community

Cover image for How to Stop Forgetting and Start Compounding Your Learning Using Spaced Repetition

How to Stop Forgetting and Start Compounding Your Learning Using Spaced Repetition

João Eira
・19 min read

There are few feelings as frustrating as when you discover you’ve no longer remember how to do things you could do before with a hand-tied behind your back.

This is especially the case when you’re learning how to code.

When you’re just starting out learning how to code, you are constantly having to jump back and forth between many different technologies and concepts you’ve never heard about before. It’s easy to become overwhelmed with everything you need to learn and remember.

One week you’re getting up to speed with how to manipulate arrays in Javascript, and then the next you’re learning about all the myriad ways you can make things look pretty with CSS.

After you’re done spending a couple of weeks brushing up on your CSS skills, Flexbox and Grid are no longer strangers to you. You’re proud of yourself for getting these down. You’re one step closer to reaching that much-coveted goal of becoming a software developer and start building stuff for a living.

But you’re not there yet, so you decide it’s time to get back up on the Javascript saddle.

You open up your code editor with your Javascript hat on, flex your fingers, and start writing lines of code. A few moments later, a realization suddenly hits you like a bag of bricks:

You no longer remember whether it is .map() or .forEach() that returns a new array.

Your mind is drawing a blank.

You dig into the deepest recesses of your memory, but it’s coming up short. Static is what you get as a response from your memory to your query, and so you resign yourself in the knowledge that you no longer know about the difference between .map() and .forEach(), and so you’re forced to open up your browser to look for the answer.

This is so frustrating.

You used to know this like you know the back of your hand.

You spent all that time and effort learning about it but now, just because you put Javascript to the side to learn CSS, it’s like you’ve been forced back to square one.

You no longer remember what you once knew.

Learning how to code is already hard enough without your memory fighting against you every step along the way.

At first glance, your memory might not seem to be all that relevant to programming.

You can’t code your way to an industry job by cramming random pieces of code you find on GitHub into your memory and hope that one day you’ll have the opportunity to use them.

That’s just not how programming works. You have to know how to write new code, you can’t just memorize the code other people wrote.

But memory is more than just for mindless rote memorization.

At its most fundamental level, memory is the ability to store the learnings of the past so they can be used to influence the future.

Whatever you’re learning, you want the things you’re spending your precious time learning about to persist in your mind. That’s what learning is.

If you’re learning how to code, you want to put into practice what you’re learning and build your own projects, but you won’t be able to do so if you keep forgetting what you learn.

If you can’t remember things, you can’t move forward.

Memory is how you compound your learning.

You will only reach those higher levels of understanding and mastery to get where you want to be if you retain the things you learn. You want to be improving over time, not to have to retread old ground you’ve already gone over because your memory is like a leaky bucket that can’t keep inside what you throw in it.

If memory is so important then, what can you do to never forget?

Unfortunately for all of us, forgetting is inescapable. There is no such thing as a perfect memory. There isn’t a magic pill that will turn you into Bradley Cooper in the movie Limitless. But that doesn’t mean there aren’t things you can do to massively reduce the speed at which you forget things, because there are.

Science has known about what it takes to get memories to stick for a long time.

It’s just done a terrible job so far at telling you about it.

The science of forgetting

The scientific study of memory started in the 19th century when a German psychologist, named Hermann Ebbinghaus, decided he had nothing more interesting to do than spend his days measuring how long it took him to memorize a lot of lists of nonsense syllables.

I don’t know about you, but that doesn’t all that fun to me.

Each day, Ebbinghaus would pick one of his many lists and would only stop once he was able to recite every single of his nonsense syllables without making any mistake. After he managed to do so he would wait for some time, perhaps for a few days, maybe for a few weeks, and afterward, he would memorize that same list once more.

Although this might seem peculiar (surely there were more interesting things to do even in those days?), Ebbinghaus was trying to find the answer to a question we have all asked ourselves at least once: How long does it take for us to forget something?

Because he memorized each list twice, Ebbinghaus could see whether he was having an easier time at it the second time around.

If it took him less time to memorize one of his lists the second time, then that would mean a remnant of the memory of when he’d first memorized still resided in his mind.

If it took him the same time as it did before, then that meant he’d already forgotten it.

It was drudging work, but by doing so Ebbinghaus could see the effect that the passage of time had on his memory.

And what an effect it had.

When Ebbinghaus plotted his findings he noticed that his memories were at their most fragile when they were still young. He could see from his data that the bulk of forgetting happened in the few moments after the memories had been created.

Rather than happening at a linear pace over time, Ebbinghaus discovered that forgetting happens rapidly at first, but slows down with time.

In the first few hours of its life, it’s as if your newly created memory has jumped out of a flying airplane and is now free-falling through the sky, the wind buffeting its face violently as it quickly loses altitude. As the ground becomes uncomfortably close, our memory activates its parachute and begins to glide, still falling, of course, but much slower than it was when it first jumped out of the plane


Now, to be sure, the forgetting curve, as Ebbinghaus’s discovery came to be called, is an important landmark in the scientific study of memory, but it doesn’t tell us much about what we’re ultimately after, which is how not to forget what we learn.

After all, we all know that we forget things. It’s why we’re here in the first place!

But Ebbinghaus didn’t stop there. Armed with his data, he could see that the speed at which forgetting happened was greatly influenced by this one variable

That variable?

How he spaced his learning over time.

What do I mean by that?

Let’s run a little thought experiment.

Suppose Ebbinghaus had ten hours with which to memorize one of his lists of nonsense syllables. He can spend his allotted ten hours in a single manic-inducing sprint, or he can space them over the week however he likes it best.

You’d think that wouldn’t make much of a difference. After all, Ebbinghaus is still spending the same amount of time learning his chosen list in both situations. The only thing that’s different is how he chooses to spend those hours.

Yet that single change made a world of difference.

Ebbinghaus discovered that if he spaced his ten hours over time instead of massing them in a single sprint not only would his memory get stronger, but it would actually take him less time to memorize his list.

Simply by changing how he studied, Ebbinghaus could have the best of both worlds: a better memory with less time spent studying.

It need not be pointed out how important a discovery this is.

If someone came up to you and told you about a revolutionary studying method that would not only cut the time you spent studying but also get you to retain the things you learn for longer, you would think you were being sold on some sort of scam.

Yet the spacing effect, as Ebbinghaus’ discovery is called, is far from being a scam. It is one of the most scientifically supported discoveries in the entire field of psychology.

The gist of the spacing effect is rather simple: Given the choice between massing all your studying or spacing it out over a period of time, you are better served by spacing it out.

Isn’t that a wonderful finding? But there’s a catch.

While spaced repetition has been proven to work time and time again, people have trouble applying it. There’s a reason why so many students pull all-nighters to cram for their exams. You’ve probably pulled one yourself.

Spaced repetition is neither intuitive nor simple to do by yourself.

If you’re trying to learn something, waiting for some time to pass until you can go over the material again feels weird. For what absurd reason would you sit around and do nothing when you could just open up LeetCode and do another coding challenge right this moment?

Yet, according to the spacing effect, that would be an ineffective and inefficient way of learning. You’d be better off waiting instead of grinding the same material over and over again.

How then are we to implement spaced repetition into our lives?
Are we to jot down in our calendars the days when we’re supposed to study something and hold strong in our resolution to follow it? This might not seem to be not that hard nor too much work, but what if you’re learning multiple things at the same time, as you are when you’re learning how to code?

Trying to juggle all the different things you’re learning and scheduling them so that you can make the most benefit out of the spacing effect would rapidly turn into a mess.

Thankfully, there is software that will help you deal with the drudging details of incorporating spaced repetition into your life that will free you to focus on what matters, which is learning how to code.

The unreasonable effectiveness of spaced repetition software

Wouldn’t it be wonderful if we could offload the decision of when to study to a computer?

That’s where spaced repetition software comes in.

Spaced repetition software use battle-tested algorithms whose job it is to schedule when to review the material so that we can take advantage of the spacing effect.

Starting to use spaced repetition software is of the most impactful decisions you can make.


Because spaced repetition software makes memory a choice.

So long as you keep using it, anything and everything you put in it has the potential to become something you remember forever.

Doesn’t that sound like a superpower worth having?

Memory is how you compound your learning, and spaced repetition software makes memory a choice.

So, which spaced repetition software should you use, and how do you use it?

Regarding the first question, while there is a large offering of programs that all implement the same sort of spaced repetition algorithms, with some modifications here and there, the one that is most well supported and most people use is Anki.

Anki is free, it’s open-source, and has been in development for more than a decade. It has a large community of users around it, and it’s by far the best one available and the one I recommend you start using.

But how exactly do you go about using Anki?

It all starts with a simple flashcard.

Everyone knows how a flashcard is supposed to work. You write something on the front, then something on the back, and then you’re supposed to recall what it was that you wrote on the back after reading what’s on the front.

The only difference is that Instead of writing flashcards on a piece of paper, you write them in Anki.

At its core, this is all there is to it.

But let’s be more specific about it.

I will show you from the beginning how you can use Anki to aid you in your journey of mastering your memory to learn how to code.

The first step is to install Anki. You already know this of course, but it never hurts to start with the very basics

Once you’ve installed it, you will be presented with the following screen:


This is the main Anki window and it shows the Decks you have in your collection. A Deck is just a group of cards. You can have as many decks as you want - although Anki struggles when you have a lot of them - but for most people, a single deck will suffice.
On the top menu above there is an Add button. Click on it. It’s time we create our first card.

Once you click on the Add button, this window will appear:


This is where Anki can become a bit confusing, but I will demystify it for you.

Know that although Anki is a powerful piece of software, you can do without knowing most of its features and intricacies. You get the bulk of its benefits solely by using it, so you’re better off using it even when you do not understand how all of it works than never using it at all. As the saying goes, perfection is the enemy of good and to use spaced repetition to develop a stronger memory, just using Anki is more than half the battle won.

The first thing to understand about how Anki works is that a Card - like the flashcards you already know about - is created from a Note. When you click the ‘Add’ button, the thing you’re adding is a Note, out from which one or more cards will be created by Anki.
In the picture above, the Note I created has two Fields: Front and Back.

The Front is where you put your question, and the Back is where you put, you guessed it, the answer to that question. It works very much like regular flashcards. You put questions on the Front and answers on the Back.

Using an example from my personal Deck, here is a card that I added not too long ago:

Question: What are the three components every HTTP message has?
Answer: A start-line, the headers, and the body

Once you put your question and answer into Anki and click on the ‘Add’ button below, Anki will pick both the Front and Back fields and use them to create a card with the Front as the question and the Back as the answer. However, Anki will only create cards that way because it has been told to do so.

If you look back at the image above, there is a little option at the top titled Type. A Note Type dictates how many fields a note has and tells Anki how to use them to create cards. In our previous example, the Basic type dictates that a note has two fields, Front and Back, but you can create your own note types to suit your personal needs.

By default, Anki comes with two note types installed: The Basic, which we’ve already met, and the Cloze.

The Cloze note type was created with cloze deletion in mind.

Cloze deletion, admittedly a rather strange name, is when a portion of a text is omitted, and you have to remember what fills in the blank. If instead of, “This is a cloze deletion” I wrote, “This is a ____ ______”, then it would be your job to fill in the blank with ‘cloze deletion’.

To create a card using the Cloze note type, click where it says Basic; this will open up a window showing all available types for you to choose from. Select Cloze. Now you’re ready to create your first Cloze card.


Whereas before you had to add a question and an answer to create a card, for the Cloze type you merely have to tell Anki which portions of the text you want it to test you on. To do so, you need only select the portion of the text you want, go to the toolbar above, and select the fourth icon from the right, the one that looks like this […].

In the image above, I selected two pieces of the text, “cloze note” and “two cards”. Anki, knowing that this card is of the Cloze type, will create two cards from this single note. The first card looks like this:

This is a [...] that will create two cards

Whereas the second one looks like this:

This is a cloze note that will create [...]

To answer these cards correctly I need only fill in the blank.

This is a […] that will create two cards ⟶ This is a cloze note that will create two cards


This is a cloze note that will create […] ⟶ This is a cloze note that will create two cards

The cloze type is very useful, as you can see. For example, I could rewrite the question about the three components of a HTTP message in the following manner:

Every HTTP message has the following three components:


Anki will use this to create three cards from this single note, one for each component. When the time comes to review one of these cards, Anki will show me:

Every HTTP message has the following three components:

And I will have to answer: Body.

It is unlikely you will ever have to create your own note types. The Basic and Cloze will cover most of your needs, and because perfection is the enemy of the good enough, trying to squeeze all efficiency out from Anki by creating your own hyper-specific types will only backfire when you find yourself not using Anki because it is too much work.

Keep things simple and you won’t fall off. Remember, just using Anki is more than half the battle won.


Now that you’ve added your first cards, it is time to review them. To do so, click on your deck in the decks’ list and then click on the Study Now button.

Because I created the cards I was showing you above, this is what appears to me when I do so:

Now I need to try and remember what the answer to this is. Because this was just an example there’s no answer for me to remember, but if the question were to be, “Which spaced repetition software should you use?”, my task would be to recall “Anki”.

When you have the answer in mind, or if you are incapable of recalling it, you click on the Show Answer button.

As you probably figured out, Anki will show you the answer:


Now comes the time for you to grade your memory.
In the image above, there are three options: Again, Good, and Easy. They are ordered by degree of difficulty in remembering the answer.

If the memory has vanished entirely from your mind, then you select the Again button. That tells Anki that you need to spend more time with the material, and it will make sure to present it to you sooner rather than later.

On the other hand, if the answer came to you instantly, that means your memory of it is strong. By selecting the Easy button Anki will know that you likely do not need to review the material for a while.

Here is one example of the options that appear in one of the cards in my personal Deck I have to review today.


As you can see, I have four options to choose from rather than the three above because I have already encountered this card many times before, whereas the previous card was newly created.
You may also notice that if I choose the Easy option, which I did because the answer to this particular card came to me instantly, Anki will only show it to me again approximately nine months from now.

That is the power of the spacing effect, combined with the magic of Anki, in action.

What were the chances that 9 months from now I would remember I needed to review this question and see how well I still remembered its answer?

None. There’s no way I would remember to do that. But with Anki, I don’t need to. It takes care of all of that for me.

Now that you have a clearer understanding of how to use Anki, a further question, perhaps the most important one, remains:

What should you create cards about?

A word of caution...

When people start using Anki, the experience can be exhilarating. To finally be in the control seat of your memory is a feeling unlike few others.

Where before learning felt like a constant struggle, as if you’re swimming against a fast river current, now, with your memory as an ally by your side rather than an enemy trying to stab you in the back, it can feel like you have superpowers.

Yet with such exhilaration comes danger.

Not life-threatening danger, mind you. Nothing of that sort.

It’s just that because Anki is such a powerful piece of software that can massively increase the lifetime of your memories, it can be tempting to create a myriad of flashcards in the hopes that Anki will do the hard work of uploading their knowledge into your brain.

Using Anki like this is a mistake because Anki does not replace the need to spend time with the material to understand it.

All it does is present to you the flashcards you’ve created at optimally determined intervals to make the most out of the spacing effect, but by itself Anki can’t make you understand the material. You have to put in the work first before you start creating flashcards about it.

That’s mistake number one people make when they start using Anki.

The second mistake people new to Anki tend to make is creating cards about everything and anything under the sun.

Obscure bash-one liners that seem neat? Away to Anki they go.

Little-used git commands you hope to one day use to impress a senior engineer at your company? Anki seems like a useful way to not forget them.

Random Javascript functions you read about in a random article? Surely you’ll use them one of these days, right?

This is likely the mistake that has done the most to get people to stop using Anki.

What ends up happening is that because you don’t have a clear picture of why the cards you’re adding are valuable to you - you just added to Anki because they might be useful, one of these days - you will have trouble recalling them when Anki determines its time for you to review them.

Due to the way spaced repetition algorithms work, because you keep failing to successfully review these cards, they will keep appearing in your daily reviews. And you will continue to fail them. And they will keep appearing, and so forth until you lose all motivation to use Anki because it’s frustrating to open it up knowing that you will continue to fail your reviews.

To get the benefits of Anki, you need to keep using it. That must be your number one priority.

Which is why you need to be selective about the flashcards you create because, otherwise, you will find yourself in a situation where you stop using Anki altogether.

So, with that word of caution out of the way, an important question remains.

What should you create cards about?

When thinking about what to create cards about, there is a heuristic that will never fail you:

Create cards that will stand the test of time.

What do I mean by that?

Technologies come and go. The hot new frontend framework of this year might not be so hot the year after. If you spend a lot of your time creating cards about each shiny new thing then once the industry moves on to greener pastures and what was once shiny has lost its luster you’ll be left with a bunch of cards that no longer have any value.

Even in a fast-changing field like programming, some things hardly change with time. One such example is the Unix command line.

Quantum physicist Michael Nielsen has written about how he used Anki to finally learn the Unix command line. He’d been frustrated for years for never having learned it before, so he thought it not only would be a useful thing to learn but would also be a good use case for learning how to use Anki.

As he writes, “Anki [made] it easy to learn things that would formerly have been quite tedious and difficult for me to learn.”

You want the cards you create to pay out dividends, and the cards that payout the most will be those about technologies that are long-lived, rather than short-lived.

A useful mental model to apply here is the Lindy effect.

The Lindy Effect is the idea that things that have existed for a long time will likely continue to exist for a long time after. Their mortality decreases with time and each additional year nets them a further year of life.

The flip side of the Lindy effect is that things that have existed for only a short time do not have their continued existence guaranteed. Each year that passes is one less year they have to live. Most frontend frameworks function like this. Their shelf-life is short - just ask jQuery.

You want to add cards about technologies and concepts that have the Lindy effect working for them. The Unix command line is one example of something that isn’t going away anytime soon, but there are plenty more. The fundamentals of Javascript are unlikely to change. The nuts and bolts of Computer Science are pretty much set in stone. Cards about these topics will always pay interest.


Although Anki does not support syntax highlighting out of the box, the community has developed an add-on that allows you to insert syntax-highlighted snippets of code into your cards. I wrote about some other add-ons you can install to make the most out of Anki here.

To give you a sense of how I have used Anki to learn how to code, here is a card from my personal deck:

Question: With which methods do you pass functions to the onRejected array of the Promise object?

Answer: .catch() and the second argument of .then()

Notice how this question explicitly lays out the answer it expects.

This is important.

Because of the expanding scheduling inherent to the spacing algorithm that Anki uses, I can go months, or even years, without ever seeing this card.

If a question is not explicit about the answer it is expecting, by the time that question shows up in your daily reviews, you will have trouble answering it correctly because not only must you venture into the blackest depths of your memory to pluck out the answer, but you must also first decipher what the question is asking you about.

Suppose I’d written that card like this:

Question: Pass functions to the onRejected array.

Excuse me, what?

There are multiple things I would have to figure out before I was able to answer this correctly.

I would have to recall that I am talking about Promises and that I should answer with the methods that allow me to pass functions that will be run if the Promise is rejected.

The chances that I fail to answer this card correctly are much larger than if I’d spent a little more time wording it so that by the time future-me encounters this question he doesn’t have to figure out what the hell present-me was talking about.

That’s a good heuristic to follow: Write your cards expecting your future self to have forgotten what you mean by the question.

To recap:

  • Memory is how you compound your learning
  • Forgetting is inescapable, but you can fight back
  • Spaced repetition has a century-long proven track record
  • Anki handles the dreary details of integrating spaced repetition into your life
  • The most important thing is to do your daily reviews, well, daily
  • Add cards that pay dividends. Be mindful of the Lindy effect and avoid chasing every hot new trend.

If you have any questions, you can find me on Twitter at @joaoeira . You can find more of my writing at Superpowered Self where I write about increasing cognitive fitness and how to make the most of your mind.

Discussion (1)

dnecklesportfolio profile image
Dwayne Neckles

The best powerful part of this article "It is unlikely you will ever have to create your own note types. The Basic and Cloze will cover most of your needs, and because perfection is the enemy of the good enough, trying to squeeze all efficiency out from Anki by creating your own hyper-specific types will only backfire when you find yourself not using Anki because it is too much work."
Thank you so much for the reminder. I stopped using Anki before for that exact reason.