Hacker News new | past | comments | ask | show | jobs | submit login
Memorizing a programming language using spaced repetition software (2013) (sivers.org)
46 points by hn17 on Nov 10, 2019 | hide | past | favorite | 43 comments



I have been using anki for almost ~3 years now to study Korean vocabulary, sentences, and Japanese kanji. I'm also a software engineer for my day job. I've also written about anki. [0]

I don't see the value in memorizing programming -syntax-. It's irrelevant to me to remember how to open a file in ruby or do a specific command- that's what search engines and then my personal wiki is for.

If I worked -only- in ruby, then I'd likely remember those specifics much more, but since I hop around with rust, python, c#, clojure ... depending on our clients, there's no way I'm going to remember stuff like that for every language. Especially since languages tend to get updates and changes!

I would use anki to retain knowledge of stuff like more complicated data structures. Right now, I just search for what I need, then toss it into my personal wiki folders. I can then use notational-fzf-vim to rapidly fuzzy search my markdown files. [0] I keep these synced across computers with a selfhosted nextcloud instance.

[0]: https://andrewzah.com/tags/anki

[1]: https://github.com/alok/notational-fzf-vim


I defer. I value remembering syntax of programing language. Not all syntaxes, but your commonly used ones.

I have been remembering Python syntax through Anki. Recently, I needed to write some adhoc scripts for backfill. I felt so productive without looking at any references. It took me 3x less time to complete my task compared to always looking at references.


> It took me 3x less time to complete my task compared to always looking at references

What happens if you include the time you spent drilling yourself with Anki? Are you still ahead?


If I worked -only- in ruby, then I'd likely remember those specifics much more, but since I hop around with rust, python, c#, clojure ... depending on our clients, there's no way I'm going to remember stuff like that for every language. Especially since languages tend to get updates and changes!

They change that often?

I memorized the programming syntax so that hopefully next time I opened up a language I haven't seen in years, I don't have to stumble around trying to catch my footing.

I also found that I have terminologies issue which may make communication difficult, so it's a good idea to have labels for structures in your program.


> They change that often?

Typically not very much, but it -can- happen. I don't see the need to have stuff like that memorized when I can just check my wiki, or search online if that fails. Or I can even just look at one of my past codebases really quick with fuzzy searching or grep.

For any domain that I'm working in, it's typically unnecessary anyways. I do a lot of work in Rust right now so I have most things like that off the top of my head, etc.


For any domain that I'm working in, it's typically unnecessary anyways. I do a lot of work in Rust right now so I have most things like that off the top of my head, etc.

I also use the "wiki"(mine is just a series of atomized plain text notes) to learn stuff and look up. When that failed, I used google.

I just think that memorizing syntax is potentially valuable in switching context.


Pretty much exactly what I was going to write except for the languages mixture that for me is a bit different and probably more fast jumping. Thanks :)


Thanks for sharing.


What's the point? Programming language rigmarole is well on its way to being automated. It's better to memorize algorithms. Make flashcards of Knuth, not stuff that IDEs autocomplete for you anyway.


Did you forget the sarcasm tag? Algorithms and code in books will be the first things to be automated... you have to learn how to create the algorithm that you need, not to memorise algorithms...


Yes, the point is to create your own algorithms. It's hard to create something you don't know anything about or know how other people created them before you. Imagine this in another field, say an engineer who doesn't want to study how other bridges were designed because those aren't the bridges she's going to make. Eventually algorithm and data structure design will be automated and everyone will be programming in declarative English, but that's a lot more general intelligence than predicting your next line of code is a foreach. That's why I say learn computer science not programming languages because machines already speak programming languages.


I just returned to Java after 3 years away, IntelliJ IDEA syntax highlighting, auto-completion, code-formatting, and "code analysis/inspection with suggested improvements" made it easy.


It's only going to get better. There's just so much code out there to learn from. PL grammar is a lot more machine-readable than natural language.

https://ai.facebook.com/blog/aroma-ml-for-code-recommendatio...

https://visualstudio.microsoft.com/services/intellicode/


Is there a benefit to trying to actively memorize the syntax/semantics of a language rather than just looking it up when you need to know something, and then passively memorizing the parts you use often?

Also a huge component of memory is contextual cues, which is why people find it so hard to code on a whiteboard vs. being at their normal computer/keyboard.


Is there a benefit to trying to actively memorize the syntax/semantics of a language rather than just looking it up when you need to know something, and then passively memorizing the parts you use often?

This is akin to looking up words you don't know in a foreign language and hoping through repeated exposure that you learn the right words to use. It's very slow and frustrating. It is much more efficient to just know stuff off the top of your head.

Just because you look stuff up doesn't mean you efficiently memorize those things either. Reading had been proven to be a poor strategy for studying.

Also a huge component of memory is contextual cues, which is why people find it so hard to code on a whiteboard vs. being at their normal computer/keyboard.

Context clues can be embedded in flash cards as necessary.

Although it's also possible that you're associating arbitrary clues to your cards, which would be to your detriment. For example, an arbitrary part of the card trigger the answer, instead of an appropriate context.

It's why some academics recommend studying using different rooms so that the context for your answer don't become glued to that environment.


> This is akin to looking up words you don't know in a foreign language and hoping through repeated exposure that you learn the right words to use. It's very slow and frustrating. It is much more efficient to just know stuff off the top of your head.

> Just because you look stuff up doesn't mean you efficiently memorize those things either. Reading had been proven to be a poor strategy for studying.

The research of Krashen, Mason and other L2 acquisition linguists on extensive reading for language learners directly contradicts this claim. Regular, sustained reading is considerably more effective for acquiring a language than flashcard-based methods.

Anki is great and I'm a contributor! But it's more of an ancillary tool. SRS shines when it comes to memorizing decontextualized, atomic information (e.g. countries and capitals, the periodic table of elements or writing Japanese kanji), but not for learning a language in general.


The research of Krashen, Mason and other L2 acquisition linguists on extensive reading for language learners directly contradicts this claim. Regular, sustained reading is considerably more effective for acquiring a language than flashcard-based methods.

I am not disputing reading in the language learning context as a tool for learning, especially when combined with SRS. Doesn't really apply to me since there is no widespread written component for ASL.

By reading, I meant people rereading their old notes instead of actively challenging themselves. That is, no attempt at retrieval-practice that is the basis for spaced repetition. Research said that study method is often regarded as effort in vain.

But that apply to contexts such as studying biology. Reading in a foreign language is a different context in that you are also learning new materials and practicing retrieval at the same time.

Anki is great and I'm a contributor! But it's more of an ancillary tool. SRS shines when it comes to memorizing decontextualized, atomic information (e.g. countries and capitals, the periodic table of elements or writing Japanese kanji), but not for learning a language in general.

I don't see how it's impossible to use anki for contextualized learning. It's the whole point of sentence mining. Rather, with no context, it's essentially useless since I wouldn't know how to use it in context.

Periodic table is a great example for this. When I don't know the answer to questions anki posed, I used related information to retrieve what I need to know.

In my case, I have no reading materials to sentence mine, so I just mine ASL videos.


> SRS shines when it comes to memorizing decontextualized, atomic information (e.g. countries and capitals, the periodic table of elements or writing Japanese kanji), but not for learning a language in general.

I have acquired >3,000 words from daily anki usage in Korean. Not only is it possible, it's the only way for me because inputting words into anki (or any SRS system) takes so long.

I interleave two decks: a premade sorted one with 5.8k words, and my personal deck that I occasionally add to.

The issue is that later on, you start delving into ambiguous territory for words. I've found that it's impossible if you maintain a (word in your native language) frontside and (target language word) on the backside.

Now I am slowly migrating to having the definition of the word in Korean on the front, and the target word on the back. I'm sure this won't be perfect, but it's better than having one english word potentially map to many korean words.

Using anki has bolstered my Korean learning because, well, I can recognize more words when I read or watch native material! Previously it was impossible for me to read the news because I had to look up every. single. word. Now it's more like 65-80%, which makes it much more tolerable.

In an ideal world one would learn a word, then put it into anki, but it's simple math. ~1 min per word (very generous) is only 60 words per hour. I usually fluctuate between 1-2 minutes because I have to check 2 dictionaries to make sure it's accurate, then add other data like grammatical type, and so forth. It may be easier for a language that lacks chinese characters, but I have to make 3 dictionary searches to add one card. So I only rarely add anki cards now... I have notebooks filled with lists and lists of words that I wrote down from seeing it in native material, that I just don't have time to manually add into anki.

If I were -only- studying Korean, then I could muster ~2-4 hours a week or so to add anki cards. But I have work, and life, and other hobbies, etc. Any time spent not adding cards, is more time for me to study my other decks, etc.


3,000 words is barely a start! You need much more vocabulary than that to get to a very functional level. You absolutely don't need Anki to learn that many words (which your comment originally claimed before you edited it). FWIW, I still couldn't comfortably read Chinese when I had 3,000 characters and closer to 25,000 words under my belt.

That said, I think using Anki as a scaffold for the first few thousand words is reasonable. After even 1k, I'd advise getting graded readers which are easy enough for you that you know 97-99% of the words and read 50 pages a day. It will probably take you under 90 minutes since it's easy enough that you're actually reading instead of decoding.

Progress might seem slow at first, but you'll be building a solid base with all that input and reinforcing previously learned words in many, many contexts. You'll also be getting collocations, history, shared cultural beliefs, etc. As your vocabulary builds, you can also start listening to radio or podcasts. They're less forgiving due to moving at a set speed but will do wonders for your conversational abilities.

Even when it comes to word definitions, as you pointed out, it's not a 1-to-1 mapping. The Korean word for "nose", for example, can be used for pigs and elephants as well as for humans. In English, you couldn't do that—pigs have snouts and elephants have trunks. Similarly, in English, if you talk about "black eyes" it means something completely different (bruising) than it does in Korean (dark brown eyes).

This is stuff you don't pick up from flashcards, unless you make super elaborate flashcards (which take more time than reading)!


> You absolutely don't need Anki to learn that many.

No, but anki makes retaining them much easier. There are a great many words that I've learned that come up infrequently enough that it's easy to start forgetting them. In fact, a great many of the more niche words that I learn through tv shows, etc, are easy to forget unless I'm retaining them via anki.

> After even 1k, I'd advise getting graded readers

Yes, but there aren't really any for Korean. Also 1k is really nothing at all, almost all content at that point will be excruciating to read.

I am not arguing to use anki -alone-. Obviously one needs to be reading material as well, but that's tertiary to this discussion on anki and its usecases.

> This is stuff you don't pick up from flashcards,

No, this is stuff not picked up from poorly made flashcards. I.e., most flashcards. Mine include tidbits like this when applicable. Each of my cards has several fields like hanja/grammar type/notes that I fill out, hence it taking a while to make them.


The issue is that later on, you start delving into ambiguous territory for words. I've found that it's impossible if you maintain a (word in your native language) frontside and (target language word) on the backside.

First thought is that you should do sentence mining. That way you have the context surrounding it that let you figure out how the word is meant to be used?

Second thought, have you think about using symbolic images to avoid tying a word to target language?

I found it difficult to use since you have to make your own symbols and concepts, and re-purposing images to represent something. Not time efficient, and I am not sure if it's actually effective. OTOH, it should get easier and faster as I amass more conceptual images. For example, I have an example of "one" and "hour", so I can combine them to make "one hour" without English or any other written language involved.


Well as far as a know there’s no commercial neural implant that will autocomplete forgotten words when speaking. When programming, it’s really not necessary to remember much of anything. It doesn’t hurt of course, but it’s not exactly what differentiates a star programmer from a mediocre one.


You misunderstood the point of my question. I don't think it's worth memorizing any of those things when you could be learning deeper concepts than names of standard library functions or something.


It's important to learn the names of concepts so you know what they refer to. Then, you can start diving in deeper once you have the surface level understanding down.

If you think you understand the fundamentals? That's cool. Move on.

For me, there's some doubt in my mind about definitions despite being pretty good at debugging and knowing how things work. So it's good to get those cleared up.


It kind of covers this in the article, but the theory is that by actively memorizing these things you become a better programmer because you have more tools at your disposal (and more knowledge about exactly how those tools work and what they are good for).

I'm sure all of us programmers have been in the situation of discovering a faster/better way to do something that we've been doing for years.


Personally I don't think it's worth Anki.

There are so many things that you can memorize:

- common standard library method

- code-level design patterns (like the factory pattern)

- system design patterns (like caching in Redis)

- SWE process patterns (like code review or 1-1 meetings)

Why would syntax be the right level of abstraction to repeatedly review?

The space of things you can memorize (or "cache" in your mind) is too large. So a better strategy might not be to use Anki (which optimizes for retention but takes time to set up) and instead "randomly sample" a bunch of different things so that you know the techniques out there. Then you retain the knowledge that you need by actually using it on the job.


I tried spaced repetition for a few months, but I found that I wasn't actually learning anything, I was only remembering facts. I'm not sure what I expected, but when I "learn" something, I grasp the "shape" of the concept...how it fits with other things...where its edges are...where parts of it are unexplored etc. This only comes to me by using the thing I'm trying to learn, not by injecting random facts into my memory.

If anyone has had similar experiences, I've found the best way to learn has been writing about things that I use, as I'm using them. The rule for writing in that way is only write what you've come to understand...don't just copy text that is "useful" from another source. Dive deep and learn the shape of the concept, then write about it in your own words, then move on.

By writing from your own perspective it has 2 effects: 1) it helps solidify the concepts a bit more, because you can only explain something once you've reached a certain level of comprehension. and 2) it serves as a "stack snapshot" of your mind when you had a handle on the concept, and re-reading that snapshot loads the context back into your mind very quickly.


I tried spaced repetition for a few months, but I found that I wasn't actually learning anything, I was only remembering facts. I'm not sure what I expected, but when I "learn" something, I grasp the "shape" of the concept...how it fits with other things...where its edges are...where parts of it are unexplored etc. This only comes to me by using the thing I'm trying to learn, not by injecting random facts into my memory.

One of the first rule of spaced repetition is that SRS is a system for retaining information, not learning.

Once you learn the information, then you use the SRS to retain the knowledge you built up.

Also, if you have trouble connecting individual facts into larger conceptual framework, you may not be making enough connecting notes to connect those facts.

By writing from your own perspective it has 2 effects: 1) it helps solidify the concepts a bit more, because you can only explain something once you've reached a certain level of comprehension. and 2) it serves as a "stack snapshot" of your mind when you had a handle on the concept, and re-reading that snapshot loads the context back into your mind very quickly.

Writing is what I do too. I have a note system that I devised that I looked up and revised all the time. It's part of my learning system, but I considered it secondary storage.

But beware of reading. It can make you feel like you understand something, but you really don't. Reading is considered a poor study strategy, since it mislead you into thinking you have fluency when you don't.


  var a = new Array('5');
  // what is a?

  var a = 5 + '5';
  // what is a?
It's sad that many languages force people to memorize trivial stuff like this.

This is one of the things that really impressed me about Smalltalk/Pharo syntax when I started learning it recently. The language itself encourages you to name things in a way that labels all the parameters. E.g. you can have a constructor like this:

  OrderedCollection ofSize: 5.
And method names are composed of parameter names:

  array insert: 11 before: 2.
Instead of

  array.insertBefore(11, 12);


Similar to using spaced repetition to learn programming languages, you can use the same technique to organize your problem-solving skills sharpening sessions.

A while back I made a Chrome extension for LeetCode. [0] It takes care of scheduling problems for you and the extension users love it :) It costs only two dollars, so you might want to try it :)

[0]: https://spacedleet.imedadel.me/


I wonder if I could use this technique to learn to remember important personal tasks. Not dates to do things, but just keep in my head, open your mail, sweep the floor, send thank you notes, pay your credit card bill, etc.


It may be a good idea to use posted checklist(constantly refined) in addition to anki.

In all honestly, I have no idea how useful anki would be in setting up habits.


If anyone's interested - I've written a guide to Anki and spaced repetition. I've used it for about 5-6 years and my deck is about 12,000+ cards. Much of it is based in software engineering.

https://senrigan.io/blog/everything-i-know-strategies-tips-a...


Thank you for sharing.


If you're memorizing very specific information that's going to be presented to you in exactly the way you've memorized it, this is great. I am a little skeptical, however, about how well the specific information you've memorized generalizes to knowledge of the principles behind what you've memorized.

Taking one example from the article, if the front of the flashcard is:

  var a = 5 + '5';
  // what is a?
And the back is:

  '55'
  If either side of + is a string, the other is
  converted to a string before adding like strings.
I'm sure it would work great if in a real programming context you're ever presented with literally: 5 + '5'

But whether you'll remember the principle that "If either side of + is a string, the other is converted to a string before adding like strings" when you see, say 237 + "foo" is open to question.

Of course, in this highly simplistic case you probably would remember, as it's not difficult to memorize this principle even without the flashcards, but with more complicated examples I suspect it could be a real problem.


If you're memorizing very specific information that's going to be presented to you in exactly the way you've memorized it, this is great. I am a little skeptical, however, about how well the specific information you've memorized generalizes to knowledge of the principles behind what you've memorized.

Difficulty in generalizing things is a common problem from learning. Unfortunately, from what I know from research, the best way to overcome this is through lot of examples, especially examples that seem contradictory.


No, the best way is to read a proper explanation and understand the concept and the apply what you learnt writing some code in a different context. If you are trying to understand a programming language just by reverse engineering it and memorising the keywords in Anki then probably is not going to work.


No, the best way is to read a proper explanation and understand the concept and the apply what you learnt writing some code in a different context. If you are trying to understand a programming language just by reverse engineering it and memorising the keywords in Anki then probably is not going to work.

What make this difference from generating and creating your own examples, as I suggested?

As I said, this is a common problem in learning, not just programming.

Conceptual explanation is not enough, and neither is a single example. Otherwise, you will get surface level misunderstanding instead of deeper understanding.


Great post! Whenever I’ve gone down the path of trying to memorize stuff using spaced repetition or flash cards, it has rarely paid off. I’ve found that real practice works better for me. For example, I’ll create and run a vim macro command 10 times when I realize I’ve forgotten how to write macros. It’s like playing a musical instrument.


I just started a new job and have been learning Spark + Scala with Anki. Whenever I need to Google something, I make sure to make a flash card for it.

Its working well so far.


Probably you are memorising it rather than learning it unless I misunderstood what you are saying...


While Anki is great, I don’t see much value in using it for programming. I personally use it for equations and find it works very well. While remembering an equation is super useful, remembering APIs and stuff just isn’t. Intellisense solves the problem and even if you don’t have access to it (Python cough cough), it’s not that big a deal to just look up the documentation. Looking up the “documentation” (hah!) for equations is actually genuinely time consuming.


> it’s not that big a deal to just look up the documentation.

Imagine you don't know the language and are trying review a few thousand lines of code.

Well, you wouldn't be doing that if you don't know the language, right? But that's just it; maybe spaced repetition can be a good way to get there, especially if you're already an experienced programmer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: