96 points · by tosh · 2y ago · 62 comments
When we use anything, spaced repetitions come naturally (so it is also why our brain is tuned to them!). Artificial spaced repetitions are often helpful when we learn in an artificial environment - a new human language when there is little opportunity to practice it, things for an exam, etc.
With programming languages, as long as you have a computer, there is no reason to learn it without actually using it.
Arbitrary things like obscure names, weird parameter orderings, mutated inputs, etc are all the sorts of gotchas that can be learned up-front if you care to know them before being bitten.
An example for Python is the del statement `del d[key]` which I find arbitrary and non-intuitive.
Actually when learning any language I usually learn the collections usages early--these would be good to memorize rather than repeatedly looking up and learning case-by-case as a time saving (non flow state breaking) measure.
For Swift it was all the weird call forms with keyword/symbols that move around rather than being additional parts of a complete form.
Other things - well, there is Google, there is StackOverflow, and now - also ChatGPT with GPT-4.
Sure, it might not be enough for learning (at least, not for everyone), but well enough to avoid needless memorization. Memorization always comes at some opportunity cost of using time (and, well, brain capacity) for something more fruitful, e.g., learning good programming patterns, wise abstractions, etc.
I'm fluent in Python, but had spent most of my time in 2.x. When I had to finally switch to 3.x, I went through all the 3.x release notes for new capabilities. One thing stood out: scandir was the preferred method compared to os.walk.
There's no way I'll remember that and I'd be too lazy to Google it. So it went into SRS.
Ditto for concurrent.futures (broke my habit of using multiprocessing directly).
The other use case for SRS and programming languages: There are always languages I use only occasionally (e.g. Emacs Lisp) So I'll never develop muscle memory. Using SRS significantly boosted my Elisp capabilities.
I don't code in JS, but I decided to take a course on it and put a lot of the stuff in SRS. I've almost never used JS since, but a coworker is using it in a project we're both working on. I was looking at his code, and pointed out to him various alternatives that he wasn't aware of (e.g. newer features since the time he learned it). Definitely would not have been able to do it without SRS. I can mostly read/understand his code. Again, almost entirely due to SRS.
This is a fantastic use case that I hadn’t thought of.
One big problem with DSLs is that unless you use them on a near daily basis, you’ll keep forgetting how to use them. They really need to be worth the memorization cost that they introduce to a system. But SRSs can help.
Without chat AI, or an expert Q&A forum, it is difficult to search for the best solution for a complex problem articulated in its entirety.
What will end up happening is that you will convert your Y problem into multiple smaller X problems and search for how to solve those. You will design the solution to the problem in the abstract language of your mind using these smaller steps, and then map those steps to the programming language. You can much more easily look up smaller steps such as "find the index of a character in a string".
By the time you get to these small steps, you're imagining a detailed solution, whereas the language could offer something more direct.
One tell tale sign of this is code that contains functions which have exact equivalents in the standard library.
When you ask the programmer why they didn't use the library functions or built in syntax they will often say, oh I looked for something like that, but didn't find it; it was faster to just write the code than to look for it.
Spaced repetition isn't about learning, it's about remembering. From the article:
> Flash cards are for remembering what you’ve learned.
Flash cards are great for something that you don't use often but still want to remember. I use it a lot for CLI options (docker, ripgrep, etc), parts of the standard library that are useful once in a while but not always, algorithms, editor shortcuts. It also means that when you switch environments you can still remember everything.
There are lots of things that you don't use day to day that it may be useful to have in memory when the need arises. That could be libraries, syntax, concepts, patterns, etc.
An example for me is CSS flexbox. I work with CSS just enough that when I need it, I don't want to sift through blog posts and MDN documentation to get what I need; I just want to know it. Chances are you can think of similar situations in your own work or personal life.
In other words, you could equally say "I work with CSS just enough that I don't want to spend ages learning it via SRS; I just want to look it up when I need it".
The key is making looking things up as painless as possible.
You can always code around not knowing your entire programming language or libraries.
Spaced repetition is obviously a tool for someone who wants to know all the nooks and crannies, in order to become a walking reference.
It could always be used for a subset. If there some 15% of some language you think you're going to use, and not much more, you could still SRS on that 15%.
While you are trying to Google the right thing and make use of the answer, you're missing the limited chance to be talking with people in Spanish, had you already known it.
Instead of Googling "how do I trim a string in {language}" you could be thinking about the problem you actually want to solve.
There's no parallel to programming languages even in the slightest. Especially once you recognize patterns across syntaxes, the immediate value of understanding any one programming language plummets to near zero. Exceptions might be:
- SQL, just a singularly useful syntax to internalize. Probably also goes for datalog if you use that.
- Bash
Actually, that's all I can think of.
I suppose if you're googling an open-ended error with little context it's probably rougher now, but I don't see how you could possibly prepare for answering questions about arbitrary errors with no context via flashcards.
A different article[1] sums it up pretty well: "Anki makes memory a choice, rather than a haphazard event, to be left to chance."
Memorizing a programming language using spaced repetition software (2013) - https://news.ycombinator.com/item?id=30545544 - March 2022 (9 comments)
Memorizing a programming language using spaced repetition software (2013) - https://news.ycombinator.com/item?id=21481461 - Nov 2019 (43 comments)
The hard thing is building the deck. With pre-built decks I expect to greatly reduce the effort required while getting most of the benefits of spaced repetition learning.
However, he's also shown that cards can be written for a general audience with careful thought, see his & Michael Nielsen's work on http://quantum.country.
I'll be curious to see how python.cards goes!
I only have 1 problem. There is no good space repetition app on for smartphones. Websites & computer apps are just too clunky for me to use the effectively.
I would like to build one, but I really don't have a comprehensive on how the entire concept works and how to implement it.
Does anyone recommend any great books or resources that comprehensively describe space repetition & how to use it effectively
God bless you!
It would be easier if the features were reduced & the app kept minimal. Think the apple notes app & Google keep, but for space repetition. Anki feels like Microsoft Word.
Also a sample collection of decks with something to start learning right away (just to understand how the app works) would help me alot. Maybe a language, math theorems, APL verbs etc.
Haven't tried it myself but it seems like a more modern/gamified version of Anki.
I wish there was a market place for spaced repetition decks on different topics/fields. It does seem like the closest thing we have to downloading a "topic" into our brain.
Anki has https://ankiweb.net/shared/decks
So far I'm really enjoying the geography decks, like https://ankiweb.net/shared/info/2109889812
Ok, you can learn all that while using the language, but a card deck allows me to review it 5 minutes before sleeping.
https://chat.openai.com/share/10801cef-37a5-41cf-a0d3-52cf38...
I don't see why you'd try to memorize a language. We have the Internet. /shrug
In Python, I can use regex from memory. In Swift, I have to look up the docs every time. It would be nice to have it memorized.
https://experimentallearning.substack.com/p/functions-descri...
There are times when you can't recall a card. But you can't move on to the next one until you answer it. You take a break for five minutes and, poof, you remember the card! In that five minutes, you could have reviewed more cards.
If you bury it the card, you won't see it until the next day; it doesn't play well into this situation.
Anki should let you review all the cards that are currently due in any order; i.e. move back and forth among them and answer them in any order you see fit.
https://experimentallearning.substack.com/p/functions-descri...
I enjoy reminding him of my time in the army. We were just handed rifles and grenades and told to just go learn by doing.