Every developer has been there: you start coding and finally when you reach your flow state, in which you are the most productive, you have to look up usually simple things like a built-in function call or syntax of your used programming language.
And poof! There goes the flow state as you try to find the Stack Overflow post you used for the exact same thing the last time. So how can you make sure that this happened the last time?
I found that the most useful thing to do is to practise those few function calls and code-snippets daily using Anki.
What is Anki?
I’m glad you asked!
I’ve been using Anki a lot lately. Not just for University but also for coding. The reason is that I want to code faster and don’t want to look up functions or other syntax related things on the internet all the time. Since I started memorizing syntax and small code snippets with Anki I have much more time for actual coding.
If you don’t know anything about Anki yet, you are missing out on a really powerful and easy to use application that connects the active recall learning technique with spaced repetition and allows you to memorize all the things you put into it. It is an open source tool and with the right add-ons it can be tailored to any needs and can be a very powerful tool.
For more information just do a quick YouTube search on it or head over to https://apps.ankiweb.net.
So how can I get started?
First you need to download the Anki app from the link above. Just install the app on your computer and open it. It should look something like this:
Great! You installed Anki! Now we can add a new deck. To do this, click on the “Create Deck”-button at the bottom. For this short tutorial we will name our deck “Medium”.
Then hit “Enter” and the deck will appear right on the starting page of Anki.
Can you see the “+” next to the decks I already have in my Anki? That means they consist of other decks. You can think of it like decks in a folder. This is something I discovered by accident and didn’t know the first few months I was using Anki. As you can imagine the more decks you have the bigger the mess. To create “subdecks” you can create another deck and use the existing deck as a folder by using double-colons like this: “Medium::Python”
To reveal the true power that Anki provides for memorizing coding syntax we need to install an add-on called “Fill the blanks — Multiple type:cloze support”.
You can install add-ons by clicking on “Tools — Add-ons — “View add-on page”. On this page you can find all add-ons that support Anki 2.1. These are all programmed by the community. Now search for “Fill the blanks — Multiple type:cloze support” and copy the number on the bottom of the page.
Go back to your Anki-add-ons window and install it by clicking on “Get add-ons…” and then paste the code. Now restart Anki.
Before we can go on you need to change a card type for the add-on to work properly. For this step go back to the add-on page and follow the instructions there to create the right cards template (I will skip this step here).
Now we can start adding cards.
Let’s add some cards!
To add cards just click on the deck and choose “Add” on the top. You will see something like this:
Make sure you choose the correct card-type under “Type” in the top left corner. It has to be the card type you specified while setting up the add-on.
So now that we have the right card type we can finally add some content. I will add a simple example to check if it works.
Now click on “Add” or hit Cmd+Enter on your keyboard. Then we close the Editor.
Now we see one card in our deck and the status of the card is learning
We now choose “Study Now” and get the question with an input field
Now type in the answer and hit enter. You can see I answered it correctly, so it’s green.
Meaning of the buttons
As you can see there are 3 buttons on the bottom. They indicate the time-interval in which you will see this card again.
As the card is new it is in “learning-phase”. The standard Anki setting wants you to answer new cards twice when you see them the first time. After that you will see the card every day till you reach your 4th day. That’s where the card is no longer in learning-phase, and you will see the card less often.
This algorithm ensures that you keep memorizing new things the first few days and then remember them in constantly bigger intervals, so you don’t forget them. But for the algorithm to work properly you need to do your cards every day. Here is a diagram explaining why this work so good
You can now start filling your Anki with all syntax stuff you want to memorize. The most important thing to keep in mind is: do ANKI Every day! Only that way you can get everything out of the algorithm. Even if it will take a little longer at the beginning you will see that after a few days or week you see your cards just occasionally. This way the things you learn stay in your long term memory.
Anki is a very powerful tool I use for every subject every day. It does not matter if it is for Engineering, Languages; Programming or other things. With the right add-ons (I have about 15 installed) it is the easiest and fastest way to learn new things.
If you are interested in other add-ons I have or an Anki workflow then leave a comment.