Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Code Cards – Anki for code (codecards.me)
152 points by oskarth on Jan 30, 2017 | hide | past | favorite | 52 comments



I use Anki for code. Here's why Anki beats Code Cards.

Code Cards's differentiating feature is the ability to type the answer before viewing it.

But I've found it's crucial that each card be fast. Typing the answer would be way too slow.

For Ankying something like "echo $PATH | tr ':' '\n'", it's better to create multiple fill-in-the-blanks cards testing each part:

* Write $PATH on separate lines: ___ $PATH | tr ':' '\n'

* Write $PATH on separate lines: echo $PATH ___ tr ':' '\n'

* Write $PATH on separate lines: echo $PATH | ___ ':' '\n'

* Write $PATH on separate lines: echo $PATH | tr ___ '\n'

* Write $PATH on separate lines: echo $PATH | tr ':' ___

(Skip the first two if you already know "echo" and "|".)

When these cards come up you only need to spend a fraction of a second. And if you forget one part, you only need to fail that one part.

Still a nice project. Anything to increase awareness of Spaced Repetition :)


I've tried the multiple fill-in-the blanks card approach with Anki, but I'm personally not a fan. It feels too complex and reductionistic for code, but YMMV. Speed is indeed of the essence [1], but I prefer to actually feel myself coding the interesting parts of the code, not just filling in a blank code word here and there. It's definitely a good alternative though!

Do you have some examples of using the input field? I tried to get it to work a while ago but had issues with it. How does it play with code specifically?

1: I wrote about it here https://www.oskarth.com/srspractice/


Can you share your cards? I find it better to use prebuilt cards for me personally because I like to go through them as quick as possible and by making my own cards I feel like it slows me down for the marginal return I get for making them myself.


I'd like to share sometime but it'll take work to filter out copyrighted and personal material.


This is also doable via Anki's cloze feature.

Write {{c1::$PATH}} on separate lines: "{{c2::echo}} {{c3::$PATH}} | tr ':' '\n'"

The card above will be 3 separate cards, but takes only about 10-20% more time than creating regular cards.


Can you share how you create so many cards? Or are there good resources that you followed?


Helps that I have an hour commute each way, 5 days a week. Public transport FTW!

Aside from that, patience is key. 10 or 15 cards per day adds up over a period of years


Spaced repetition is good for pure memorisation but I'm not so convinced it is an effective or even helpful way of learning programming --- it seems it would just make you fixate on syntax and not truly understand things.


I agree it's not a good way of learning programming. To me it's a way of retaining some programming knowledge - but to retain something you need to understand it beforehand. It doesn't make sense to use this type of thing for things you don't understand in the first place.

One way I like to think about it is as a continuum - there are certain things you use everyday and thus in a sense over learn. Then there are things you only use once or twice in your life, such as a specific configuration you have to do. Code Cards is for the things in the middle, the things you only use every now and then but keep forgetting and having to google over and over again.

In terms of using it as an aid for people learning programming, I think if you spend 4 hours a day effectively coding, then spending 5-10% of that time reinforcing some of the things you've learned during the day is not a bad use of your time.


Lately I've been finding it more efficient to just offload a lot of that to search queries and reference sites (i.e. StackExchange, MDN, DevDocs).

Rather than trying to remember how to do a hundred trivial tasks correctly I focus on the task at hand and keep the reference document up on the other page.

I find it more valuable to have up to date and practiced referencing skills than to memorize a few hundred utility functions.

As an added bonus there's an intrinsic passive search for new techniques and depreciated methods.


I think it useful when learning a new language or framework. When you are completely new you can spend 90% of the time just searching for trivial answers. It also takes longer to search because you don't know really how to frame the question. I find it more useful to go quickly go through a book or online course and try to memorize some of the basics from the book before starting. Not reviewing earlier topics results in very little retention.


Yeah, exactly. I also use this for Math–there are many concepts from Statistics that I end up using a couple times a year, and which are most helpful if I remember most of the details when I need them.


> To me it's a way of retaining some programming knowledge - but to retain something you need to understand it beforehand

A critical factor here, though, is that it's very clear from the spaced repetition/testing literature that the way you learn beforehand affects retention. (e.g. Karpicke and Roediger 2008).


Yes – Piotr Wozniak (creator of SuperMemo and one of the pioneers of spaced learning) designed the system as a way to retain knowledge you've already ingested and understood.

Rule 1 and 2 from https://www.supermemo.com/en/articles/20rules are these:

> 1. Do not learn if you do not understand

> 2. Learn before you memorize

I use Anki to retain programming snippets and gotchas in the same way that Derek Sivers describes here:

https://sivers.org/srs

This article cited there is well worth reading too, as it's specific to programming:

https://www.oxbridgenotes.com/articles/janki_method_refined


I think it strongly depends on how spaced repetition is being done. Spaced repetition of content isn't useful (simply viewing), but spaced testing is [1]. Also, a test might be just testing syntax (could only know answer via docs), or more syntax+conceptual (e.g. would know answer if you understood the concept of a pipe in x language).

A big benefit of testing concepts is that people often overestimate how well they've learned something, so someone may think they have the concept down and that testing is unnecessary, which makes seeing spaced tests is a sort of long-term memory reality check.

[1]: http://learninglab.psych.purdue.edu/downloads/2008_Karpicke_...


I attempted to study for a programming certification using Anki.

In the end, I determined that I learned a lot more from making the cards than I did from studying them.

So yeah, it was a win... But hardly the way I expected.


> I learned a lot more from making the cards than I did from studying them

I found the same thing. The discipline of boiling things down into their essentials really forced me to pay attention and really thinking about the reading material.


Might be useful for some APIs and libraries. At the point you are dealing with those, you already know how to program and understand the language's syntax.


Derek Sivers has some anki cards for javascript and ruby . And a good post about it https://sivers.org/srs


I don't understand using this to learn a language. It might help you get the syntax, but there's no way to understand semantic concepts happening behind the scene. Just imagine trying to understand monads by memorizing how to use them. Personally, syntax isn't something I've ever struggled to retain, and apart from that I feel like this would be much too much work to learn a new language.


I want to agree with this. But I have to confess that my children are memorizing basic facts like "refridgerator holds milk" without having to understand any of the magic of the fridge quite well. Seems memorization of surface facts helps, a lot.


Thanks for the comment, just started using his js cards.


I've always kept a README.md in my dotfiles repo with all the bits of information I'm trying to memorize. I keep it either printed out, or a screenshot as my desktop background. Works well for me:

https://github.com/ben174/dotfiles


I'm going to make this work for me too.


It would be great if there were some predefined cards so that maybe I could refresh my Haskell knowledge or something without me having to create the material. But nice job overall!


Thank you! And I absolutely agree, this is on my TODO list.

Do you have any specific request for the types of things you would like to see?


It's been a few years since I used Anki, but one of the things that was great was that their decks were public. You could search for and take someone's deck and change it to fit your own needs, which was spectacular. (https://ankiweb.net/shared/decks)

The only downside to that was that for "good" decks that tended to be copied, there wasn't a way to see what was the "best" version of that deck or what was different. For example I had a deck that was copied a couple dozen times, and I'd make improvements to it (such as formatting, adding new questions) and none of those copies would get my updates.

So you could improve on Anki's shared deck feature by treating each deck like a github repo, with branches, pulls, etc.


I have used shared decks a few times, but it hadn't occurred to me that you could apply the open source of branches/pulls etc - interesting idea!

Another thing I'm considering is making the cards sharable as first-class citizens (perhaps under an umbrella category), rather than just dealing with decks. Do you think this would be interesting or do you think decks are an inherently better model?


It depends on how much effort you see going into each card. I always used Anki on a per-topic basis, and each topic was organized into a deck.


Clojure functions! There are a wealth of them and I end up writing unnecessarily long code - where a terser solution might be more clear. Some kind of code golf would be great.


- new language features for big languages like Javascript 6 or C# 6.0.

- classic topics like string manipulation in all major languages, the 10/20 most important Linux commands/SQL queries.


I don't know if using spaced repetition works that well for "memorizing" code that you don't use normally. Coding is the kind of thing that you do where if something is done rarely, it's probably not something you need to commit to memory. Just do a look-up of it on Google or Stack Overflow. The thing you're memorizing is too conceptual, unlike a foreign word or phrase.

This is somewhat related: I myself wrote an app to keep track of foreign phrases.[1] (I'm adding spaced repetition to review things just like Anki, too.) You write down the phrase in your source language (say English) and then the same phrase in your target language (say German). It works fine for that, but I found it ALSO useful for writing down hard-to-remember command lines I needed at work. For instance, I'd create an entry like this: for the source language phrase I'd type in something like "Start a build" and then in the target language phrase I'd type the actual command (typically very long and hard to memorize). When I needed to look up the command, I'd just type "start a build" or even just "build" (it shows multiple search results immediately like Google would). Then it's a matter of copy-pasting the command into the shell.

You could do the same thing by writing a shell alias or a script with a descriptive name, but I found looking things up with descriptive words better.

[1] http://www.ussherpress.com/lpb/


I gave it a small go recently to try and learn "loopless" methods for permutation generation. Also used it for heap methods. Plan on using it for a few other things, but haven't gotten there, yet.

In both cases, it worked better than I was expecting it to. I have no doubt that I would quickly forget either method, as I don't use them often, but I can at least type them up quickly into a scratch buffer. Even better, by having the entire thing worked out out and known at the algorithm layer, I was able to focus on some of the language specifics in implementation later.

All of that is to say, it was great for remembering pseudo code that I would then later focus on implementing. Gave me a much better appreciation for pseudo code, actually.


oskarth, I created something related but with a totally different interface and goals. I'm going to release the core evaluation engine as Open Source soon and would love your opinion. Is it okay if I ping you when I do so?


Of course! Ping me on twitter at @oskarth or email me@oskarth.com


Love the concept and simplicity of the site. Compared to hitting a site with a ton of text and a login, starting by storing cards locally made trying it out a breeze.


Longtime SRS user and Anki contributor here. Can you explain a bit about what this does that Anki doesn't? Can I import my Anki decks?


OP here. I'm a long time user and fan of Anki as well. The main difference between Anki and Code Cards is that you can code in the 'question' directly. I find it useful for code where the chunk size is bigger than you can keep in your head at a given time, as it allows you to actually type the code out. There's a scratchpad in Anki but it's mostly useful for things like Kanji, not for code.

I've previously experimented with using Anki to retain programming skills, with some success: https://www.oskarth.com/srspractice/ It still didn't feel quite natural. Another benefit of being able to code in the question directly is that you get things like syntax highlighting (and eventually, a sandboxed live environment).


Hi xiaoma, I am not OP but I made this early prototype: https://anchor.science/ and I would love to hear your opinion. The focus was on the interface and mobile website version (untested on iOS). Now I am using it daily and polishing out rough edges.

The main features I plan on adding are importing Anki decks and sync across devices.

My main question would be, how do you feel about a "Do you know this? Yes/No" vs Anki's method with more options? How do you sync your data on Anki? What would make you consider switching?

Edit: woah why the downvotes? I'd love to improve my question or remove it if not welcome so please leave a note.


I've been experimenting with a hybrid of the simpler right/wrong button layout while retaining a way to grade your recall as "too hard" or "too easy" to make adjustments as needed. When tapping the "right" button, the two adjustment buttons slide up from behind it, and it turns into a "good" grade button - so most of the time it's as simple as double-tapping it once you get in the habit, and you can still just swipe to avoid that, but the buttons are there when you need them in a way that doesn't confuse or mislead newcomers.

I need to add an animation of this flow but the beta landing page is up at http://beta.manabi.io (it's also exclusively for learning Japanese).


I'd suggest having cards where the user has to look at them and try to remember the answer rather than showing both sides of the card at once. It's just way too easy to cheat oneself by clicking the checkmark without actually having recalled the back half otherwise.


I just pushed that yesterday as my friend was asking me how to learn it the first time he sees a new word. The 2+ you do one card it will be hidden until you tap it/press space. But noted, as I want to make it as intuitive as possible.


Definitely need to hide the answer, even for the first time through. Not having the answer already there forces you to stare at the character to say "Wait, do I know this? ... is it 'foo'? click Oh, shoot, no it's 'bar'"


Fixed! Also released the library powering it: https://github.com/franciscop/recordar


Something is wrong on your site, I've taken a screenshot of my developer console. It looks like you keep fetching the content in a loop forever?

[0] - http://imgur.com/a/ZKlCi


This is on purpose. The scheduling of cards is done server-side and I use polling (perhaps too eagerly) to fetch new reviews, including of cards that have just been created. I'd eventually like to find a better solution for this (such as pushing from the server, do more work locally, etc) but it's not a top priority right now.


Cool, as long as you know :-)


Kinda reminds me of this iPhone app I found recently: https://www.enki.com/


Making a new version of an existing app (as the original submission is, with Anki) is fine, but to ape the name is pretty low-brow. Anyone want a MacDonalds hemburger?


Fantastic. I've recently been coding in Go and was thinking about doing the same to memorize the language. Do you have plans to write an iPhone app?


Not yet but I've tried to make it work OK on mobile and build in offline access from the start, but it's still a work in progress. How would you deal with coding on a touch screen? It seems difficult to me with all the special characters, but I must admit I haven't done it a lot.


It's interesting that I was just looking for something like this over the weekend.




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

Search: