~sivers/sive.rs

ref: b2f50afe9f3a46f2848387525ab5fefcaad1de58 sive.rs/site/srs -rw-r--r-- 12.2 KiB
b2f50afe — Derek Sivers ArtistData is gone 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Memorizing a programming language using spaced repetition software | Derek Sivers</title>
<meta name="description" content="I’ve been doing this for a year, and it’s the most helpful learning technique I’ve found in 14 years of computer programming.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="alternate" type="application/atom+xml" title="Derek Sivers" href="/en.atom">
<link rel="alternate" type="application/rss+xml" title="Derek Sivers podcast" href="/podcast.rss">
<link rel="prev" href="https://sive.rs/my-fault">
<link rel="next" href="https://sive.rs/boring">
</head>
<body id="article">
<section id="masthead">
<h1><a href="/" title="Derek Sivers">Derek Sivers</a></h1>
</section>
<div id="content">

<article>
<header>
<div class="blogparent"><a href="/blog">Articles</a>:</div>
<h1>Memorizing a programming language using spaced repetition software</h1>
<small>2013-01-06</small>
</header>

<p>
	I’ve been doing this for a year, and it’s <strong>the most helpful learning technique I’ve found in 14 years of computer programming</strong>.
</p>
<h3>
	Background:
</h3>
<p>
	I’m an intermediate programmer.
	I didn’t go to school for it.
	I just learned by necessity because I started a website that just kept growing and growing, and I couldn’t afford to hire a programmer, so I picked up a few books on PHP, SQL, Linux, and Apache, learned just enough to make it work, then used that little knowledge for years.
</p><p>
	But later, when I worked along side a real programmer, I was blown away by his vocabulary!
	All of these commands and functions just flowing effortlessly out of his fingers.
	We were using the same language, but <strong>he had memorized so much of it</strong>, that I felt like a child next to a university professor.
	I really wanted to get that kind of fluency.
</p><p>
	It made me think about how much I’ve <strong>learned then immediately forgotten</strong>, over the years.
	I read books or articles about some useful feature, try it once, but then I get distracted, forget about it, and go about my normal way of doing things.
</p><p>
	I wanted to deeply memorize the commands and techniques of the language, and not forget them, so that they stay at the forefront of my mind whenever I need them.
</p>
<h3>
	Spaced Repetition:
</h3>
<p>
	When you hear a new fact, it’s forgotten pretty quickly unless it’s brought back to the forefront of your mind repeatedly.
</p><p>
	You can do this haphazardly by immersing yourself in a language, for example, where the new words you learn will be brought up by chance occasionally.
</p><p>
	But memory research shows that <strong>the most effective and efficient time for a new fact to be remembered is right before you were about to forget it</strong>.
</p><p>
<a href="http://quantifiedself.com/2012/06/spaced-repetition-and-learning/"><img src="/images/forgetting-curve-srs.jpg" alt="forgetting curve" /></a>
</p><p>
	Say if you learn a new word in a foreign language, you’d want to practice it again a few minutes after hearing it, then a few hours, then the next day, then in 2 days, then 5 days, then 10 days, 3 weeks, 6 weeks, 3 months, 8 months, etc.
	After a while it’s basically permanently memorized with a rare reminder.
</p><p>
<strong>
	Spaced Repetition Software does this for you</strong>, so you can just <strong>give it a bunch of facts you want to remember, then have it quiz you once a day, and it manages the intervals based on your feedback.</strong>
	After each quiz question, if you say that one was easy, it won’t be introduced for a long time, but if you were stumped, then it’ll ask it again in a few minutes, until you’ve got it.
</p><p>
<strong>
	Go to <a href="https://apps.ankiweb.net/">apps.ankiweb.net</a> and download Anki</strong>.
	It’s a free, open source, popular spaced repetition software program.
</p><p>
	As for programming, you get where I’m going with this.
</p><p>
	What if you could <strong>memorize everything about the programming language</strong> of your choice?
	Every command, every parameter, every function.
	Every solution to hundreds of the most common problems, all completely memorized at your fingertips?
	Imagine going through the documentation or a book, and <strong>permanently remembering every single thing in it?</strong>
</p><p>
	Enough of the intro, let’s get to the HOW-TO:
</p>
<h3>
	First, learn!
</h3>
<p>
<strong>
	Flash cards are for <em>remembering</em> what you’ve learned.
</strong>
</p><p>
	Before you create a flash card for something, you need to actually <strong>learn and understand it.</strong>
	Create the flash card after you’ve really understood.
</p><p>
	(This is why it’s not that helpful to look at someone else’s deck.
	Those are just reminders.)
</p>
<h3>
	Convert Knowledge into Small Facts:
</h3>
<p>
	You’re going to be making a bunch of flash cards.
	Question on the front.
	Answer on the back.
</p><p>
	If you were just using this to memorize foreign language vocabulary, then the formatting would be easy.
	The front would have a word or phrase, and the back would have its translation, and vice-versa.
</p><p>
<img src="/images/anki-cn-1.png" alt="example chinese flash card question" /><br/>
<img src="/images/anki-cn-2.png" alt="example chinese flash card answer" />
</p><p>
<img src="/images/anki-cn-3.png" alt="example chinese flash card question" /><br/>
<img src="/images/anki-cn-4.png" alt="example chinese flash card answer" />
</p><p>
	But if you’re learning anything else, you’re going to have to put a little craft and creativity into making your own flash cards.
</p><p>
	It takes some effort to read through paragraphs of stuff you want to remember, pick out the key facts, break them down into their smallest form, and turn them into questions for quizzing your future self.
</p><p>
	Here are my best time-saving tips from a year of doing this:
</p>
<h4>
	Turn prose into code
</h4>
<p>
	If you’re reading a tutorial about programming, and come across a paragraph describing a feature.
</p>
<blockquote>“The add (+) operator... if only one operand is a string, the other operand is converted to a string and the result is the concatenation of the two strings.”</blockquote>
<p>
	You test it out yourself, play around with it, and understand it.
	So you make a flashcard to remember it.
</p>
<pre class="anki1">
  var a = 5 + '5';
  // what is a?
</pre><pre class="anki2">
  '55'
  If either side of + is a string, the other is
  converted to a string before adding like strings.
</pre>
<h4>
	Try to trick your future self
</h4>
<p>
	Sometimes you learn a “gotcha” — a common mistake or surprising feature.
</p>
<blockquote>“If the new Array constructor is passed a single number, it creates an empty Array with a length of that number. Any other combination of arguments creates an Array of those arguments.”</blockquote>
<p>
	You test it out yourself, play around with it, and understand it.
	Then make two flash cards to try to trick your future self.
</p>
<pre class="anki1">
  var a = new Array('5');
  // what is a?
</pre><pre class="anki2">
  An array with one item, the string '5': ['5'];
</pre>
  ... and then an almost-identical question ...
<pre class="anki1">
  var a = new Array(5);
  // what is a?
</pre><pre class="anki2">
  An empty array with a length of 5.
</pre>
<p>
	When the program quizzes you, it will shuffle the cards, so that hopefully your examples will intentionally catch you by surprise.
</p><p>
	You can also try to trick yourself with more complicated examples, to keep these gotchas fresh in your mind:
</p>
<pre class="anki1">
  var a = [20, 10, 5, 1];
  // what is a.sort()?
</pre><pre class="anki2">
  [1, 10, 20, 5]
  // sort treats all values as strings
</pre>
<p>
	Don’t forget to <strong>quiz yourself on the solution, too:</strong>
<pre class="anki1">
  var a = [20, 10, 5, 1];
  // sort these in numeric order
</pre><pre class="anki2">
  function compare(v1, v2) { return(v1 — v2); }
  a.sort(compare);
</pre>
<h4>
	Save the cool tricks
</h4>
<p>
	If you find a cool trick you want to remember, turn it into the answer of a small challenge.
</p>
<pre class="anki1">
  var albums = [
    {name: 'Beatles', title: 'White Album', price: 15},
    {name: 'Zeppelin', title: 'II', price: 7}];
  // make this work:
  albums.sort(by('name'));
  albums.sort(by('title'));
  albums.sort(by('price'));
</pre><pre class="anki2">
  function by(propName) {
    return function(obj1, obj2) {
      v1 = obj1[propName];
      v2 = obj2[propName];
      if (v1 < v2) { return -1; }
      else if (v1 > v2) { return 1; }
      else { return 0; }
    };
  }
</pre>
<h4>
	Make the answer require multiple solutions
</h4>
<p>
	If there’s more than one way of doing something, and you want to remember both, make your future self come up with more than one solution, so you can keep both alternatives in mind.
</p>
<pre class="anki1">
  s = 'string like this'
  # In Ruby, show two ways to turn it into 'String Like This'
</pre><pre class="anki2">
  s.split.map(&amp;:capitalize).join(' ')
  s.gsub(/\b\S/) {|x| x.upcase}
</pre>
<h4>
	Turn broad concepts into succinct examples
</h4>
<p>
	Say you just spent 20 minutes learning something that’s more conceptual, and not as much about remembering specific functions.
	Sometimes all you need is one succinct example to remind yourself of the concept.
</p>
<pre class="anki1">
  /(a(b)((c)d))/.match('abcd')
  # What will $1, $2, $3, $4 be?
</pre><pre class="anki2">
  $1 = 'abcd'
  $2 = 'b'
  $3 = 'cd'
  $4 = 'c'
</pre>
	Another example:
<pre class="anki1">
  class C
    self
  end
  class D < C
  end
  d1 = D.new
  # which object is self?
</pre><pre class="anki2">
  class D
</pre>
<h4>
	Read “<a href="https://www.supermemo.com/en/articles/20rules">20 Rules of Formulating Knowledge</a>” by Piotr Wozniak
</h4>
<p>
	The best advice on this stuff is an article called “20 Rules of Formulating Knowledge” by Piotr Wozniak at <a href="https://www.supermemo.com/en/articles/20rules">supermemo.com/en/articles/20rules</a>.
	So please read that one.
</p>
<h3>
	Run Through it Daily
</h3>
<p>
	For most efficient results, turn on your spaced repetition software once a day.
	If you go too long without, you’ll screw up all the timings, and have to re-learn stuff you would have remembered.
</p><p>
<strong>
	You can remember thousands of these facts in only 20 minutes a day.
</strong>
	I just make it a morning routine.
	Make a cup of boiling tea.
	Do my Anki.
	Drink my tea.
</p><p>
	It’s fun when quizzing yourself to add a little adrenaline, and make yourself go as fast as you can.
</p><p>
	It’s like a mental visit to the gym.
	A little intense 20 minutes a day is so worth it for the immediate and long-term results.
</p><p>
	Add some new cards whenever you can, and you’ll be amazed that everything you saved stays fresh in your mind.
</p>
<h3>
	Conclusion
</h3>
<p>
	I’ve been doing this for a year, and it’s been a HUGE boost to my fluency.
	I highly recommend it, as you can tell.
</p><p>
	Feel free to <a href="/contact">email me anytime</a> to let me know how it goes for you.
</p>
<h3>
	Read more:
</h3>
<p>
	The <a href="https://www.jackkinsella.ie/articles/janki-method-refined">“Janki Method Refined” by Jack Kinsella</a> is a great article on similar approach,and explains it even better than I did here.
</p><p>
	You can also use Anki to learn <a href="https://quantifiedself.com/blog/spaced-repetition-and-learning/">all kinds of things</a>.
</p><p>
	<a href="http://augmentingcognition.com/ltm.html">“Augmenting Long-term Memory” by Michael Nielsen</a> is an amazing article about using Anki for learning anything.
</p><p>
	Read <a href="https://www.wired.com/2008/04/ff-wozniak/">the interview with Piotr Wozniak at wired.com</a> for a story about a guy taking this to the limit.
</p>

<footer>
© 2013 <a href="https://sive.rs/">Derek Sivers</a>.
(
  « <a href="/my-fault" accesskey="p" rel="prev">previous</a>
    ||
  <a href="/boring" accesskey="n" rel="next">next</a> »
)
<h1>
  Copy &amp; share:
  <span class="url"><a href="https://sive.rs/srs">sive.rs/srs</a></span>
</h1>
</footer>
</article>
<div id="comments"></div>
<script type="text/javascript" src="/js/comments.js"></script>

</div>
</body>
</html>