Memorizing a programming language using spaced repetition software (2013)
sive.rs
sive.rs
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.
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.
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.
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.
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.
That's where my original point is - you can't do that until you have internalised (memorised) several syntaxes well enough that they drop down to automatic and you can step back and look at the patterns. If your attention is on Googling for how to write a list, it can't also be on the problem you're trying to solve. If you want to read Rust you're going to have to know what the ' does and what & does and it will be very slow going if you have to google it every time - but I'm not even sure you could google it, if you didn't have enough background to understand the concepts, and still pick it up on the fly. Say a Python programmer trying to google C++ "syntax" without having used anything low level, ever, isn't going to be designing a good C++ solution, at best they will very slowly write Python-in-C++-with-bugs.
Which raises a second point - spend some time in C# world watching people write Java-in-C#, they're both curly brace OOP languages but they are different and the runtimes and libraries and common styles and frameworks are all different. Step out to people learning Prolog and APL and "knowing the syntax" is useless, the ways of thinking and solving problems are very different to mainstream languages. You aren't going to recognise the Prolog pattern `foo(bar, Baz)` because it's not a function call and you can't google "what do the parens do" and make any sense of it being a term with a functor and arity which could be a fact or a goal or a data structure depending on the context. Here, learning/knowing just the syntax isn't sufficient to know the patterns. Or spend time with people coming from Bash to PowerShell and assuming the only difference is syntax, when it isn't.
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.
For some APIs, it definitely saves more time putting it into the flashcard. The overall time it takes to type it, and then review it over the next so many years, can be less than it takes to search it, click, and then read the Python docs over and over.
As Michael Nielsen pointed out:
> In an appendix below I estimate that for an average card, I'll only need 4 to 7 minutes of total review time over the entire 20 years. Those estimates allow for occasional failed reviews, resetting the time interval.
(He's excluding the time to type, which could be another minute or so). So anything that takes, say, 10 minutes to repeatedly look up and read over your life is better suited to be in your flashcards. If you don't think you'll need to look it up often enough, leave it out.
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%.
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
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.
God bless you!
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
> .apkg imports are able to merge changed notetypes, and can exclude scheduling data
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.