Friday, October 9, 2009

What You Have You Keep

The second law of thermodynamics states that in an isolated system, entropy is an increasing function. In his book, Do Androids Dream of Electric Sheep, Philip K. Dick talks about fighting entropy, or Kipple, as he calls it:
Kipple is useless objects, like junk mail or match folders after you use the last match or gum wrappers or yesterday's homeopape. When nobody's around, kipple reproduces itself. For instance, if you to go bed leaving any kipple around your apartment, when you wake up there is twice as much of it. It always gets more and more.

No one can win against kipple, except temporarily and maybe in one spot.

I've found that there is much truth in the Kipple Theorem. Just think of your house, which contiguously gets more cluttered over time. The same also happens to source code, if left to its own devices. It is also true of memory, which gets disordered over time. What was once clear and orderly, becomes obscure and messy.

Over the past couple of weeks, I've tried to always put something back in its place whenever I go from one room to another. When I do this with disciple, my house starts to look much better. A couple of days of slacking off, and the house looks once more like a total mess. And I don't ever remember making it a mess. It's just that kipple does multiple while you're asleep. Unless we take active, continuous action to combat it, kipple will always win.

Source code is no different. It grows smelly over time. No matter what your source control's log tells you, changes are constantly taking place. They make the code more unreadable, make methods more incomprehensible, and occasionally even introduced some bugs in unimportant locations.

The same is true when learning things, such as Japanese. I've studies nearly 400 kanji characters over the last couple of weeks. Unless I take active steps to maintain what I've learned, my neurons start getting all bogged down with kipple. That's why I am very fanatical about reviewing the items in my SRS software every day. Left alone, for even a little bit, the kipple raises its ugly head and starts to take over.

Kipple Fighting 101

When you learn chess, you basically have to study three different stages - opening, middle game and end game. For the opening stage, you basically memorize the known openings, which have already been studied thoroughly. During the middle game you need to understand basic principles and how to implement them. The end game part is usually kind of a mixture of the previous stages: memorize principles for different scenarios.

One of the most basic scenarios in the end-game is the one where you have a king and a rook and the opponent has only a king. It is very easy for you to win now. But, to make things explicit, the guiding principle is to always prevent the enemy from returning to territories from which he retreated. When the enemy king moves, you make sure he cannot move back to where he once was. You corner him into closer and closer areas.

In the endless chess game against kipple, the opposite is true:

What I have, I keep!

This means an endless game of maintenance. You've learned a new word - make sure you review it periodically. You finished cleaning the kitchen - make sure it stays clean. Constant vigilance is the key to winning this battle.

Whenever you go over source code, you will encounter kipple. It is your responsibility to engage it immediately. No matter what your current objective is, you must spend some of your time chasing and destroying the kipple. Otherwise, the kipple will take over the code base, and before you know it, no one on your team has a clue what does what.

Monday, October 5, 2009

Kill the CAPS LOCK!

The Caps Lock key can do wonders to wreak havoc in VI. You're in command mode, minding your own business, when all of a sudden all hell breaks loose. All because you pressed the caps lock key instead of the shift key.

For a long while I was reluctant to follow the plethora of tutorials on how to kill the caps lock key. The reason is that there are several cases where I thought it was very beneficial to actually use it to, well, lock the caps. For example, by tradition, definitions in C/C++ are written in all capital letters. I finally figured out how to get along without the evil key, as I will explain below:

g~w - capitalize one word
g~~ - capitalize the entire sentence
gU{motion} - capitalize motion

I still have some open issues. For example, to capitalize the word I just wrote, I have to go backwards ('b') and then capitalize it ('g~w') and then go back to insert mode ('A'). I'll be happy to learn of better options, options that take into account that I despite having to configure my setup. Nonetheless, I'm now much better off than I was with the occasional caps lock accident.

You can now make the caps lock key do something else, such as behave as a shift key or an esc key.


Further Reading:

Wednesday, September 30, 2009

Exercise

I've written before that I have the great privilege of working with people who are much smarter than myself. After more than a year of working with some ridiculously smart people, I've come to the following conclusiong:
Smart people exercise more than average people.
This doesn't mean that every smart person I know exercises regularly. I know quite a few ridiculously intelligent people who don't. But, from what I can see, the average amount of smart people who exercise is much higher than in the average population.

I've been exercising more regularly lately, and my coworkers contribute much to it. As a matter of fact, I just went for an 8km run with half of my group. It turns out that some guys with a PhD in Computer Science can be pretty competitive and this forced me to push myself.

It does feels great after wards, tough.

Promise!

Tuesday, September 29, 2009

Learning Japanese - Spaced Repetition Software

Note: this article is part of a series on how to memorize
material. You can start at:
The classical method for reviewing items you have already memorized is using flashcards. The basic technique is to create a flashcard with a question on one side of the card and the answer on the other side. Each day, you'd review several cards. For each card, you'd read the question side, try to recall the answer, and then compare your answer with the one written on the backside of the flashcard. However, this method has a major limitation:
After some time, you'll have a large "database" of several hundred and even thousand cards. It is not practical to review all of them at once. How do you know which cards to review?
 Several better techniques have been developed over time. For example, in the 1970s, Sebastien Leitner developed the system now named after him. Using this method, you'd have several numbered decks. Each time you succeed in recalling a flashcard, that card will travel to a deck with a lower priority. On the other hand, if you fail to successfully recall the card, then that card would move to a higher priority deck.

You would now schedule your reviews according to the priorities of the decks. For example. each day you would review cards from the highest priority deck, every other day you'd review cards from the second highest priority deck and so forth. This better optimizes your time - you would spend less time reviewing cards you can easily recall, and more time reviewing cards that are hard for you.

This was no doubt a major improvement. In the computer age, however, we can optimize this method much further. Computer programs which do this are called Spaced Repetition Software (SRS). The first program, of which I'm aware, that pursued this task is SuperMemo.

The basic idea of all the SRS programs are to schedule cards for review at a time in which the review will have an optimal benefit in entrenching the fact in long term memory. When you first learn a card, it is scheduled for review quite often. After each review, the program asks you to rate how easy it was for you to recall the fact. Using this data, the program can optimize the time for the next review.

The theory is that the best time to review a card is just when you're starting to forget it. If you have to sweat a little to recall the card, but you do manage to remember it, then you'll remember the card for a long time. The idea is to always live on the edge. Never have a feeling that life is easy. As in most things, this gives you great benefits - namely, long term recollection.

I've used a couple of SRS programs over the past few months. At first, I used mnemosyne, which is a cross platform, open source program. Overall the program is pretty easy to use and very streamlined. You aren't presented with too many options, and you can begin using it immediately. It also has many plugins and existing decks which you can download. The downside is that it is not very configurable, which I for one actually like. It was also a pain to install on an old PowerPC mac, but for Intel machines the installation is very easy. Finally, adding audio and graphics to the flash cards is pretty annoying.

After spending around a month away from computers, I found it was very difficult to return to using mnemosyne. This is actually a problem with all SRS programs. The algorithm requires you to use it at constant time intervals for best performance. After using it daily, a month of absence will take many weeks for the algorithm to overcome. That's why I decide to start fresh and switch to a competitor - Anki.

Anki has very similar features to mnemosyne. It also has many plugins and existing decks. However, it looks much better visually, everything about it can be configured, sound and graphics are a snap to insert and it has mobile and online versions. It can even let you synchronize your decks across multiple computers. As a final bonus, it is updated much more frequently than mnemosyne.

I've now been using Anki for a couple of weeks. This is definitely not long enough to get a feel of its scheduling algorithm. It takes many weeks of daily usage before you can start to experience the benefits of any SRS algorithm. From what I can tell, it looks like a really solid program so far, and I'm happy with it.

Further Reading
  1. Learning Japanese - Memorization: the openning article in this series.
  2. Learning Japanese - Vocabulary: shows a nifty plugin for Anki that can really help you learn your vocabulary.
  3. Configurability: what I think of configurability.

Monday, September 28, 2009

iPod Touch

I ordered myself an ipod touch the other day.

I already have an old ipod shuffle, which I take with me on runs. I also use it to listen to pod casts on long car drives. I can say I'm very pleased with it.

The question is now:

Why?

Why did I order the ipod touch. The answer is that not so much for the music. It is certainly a big step up from the shuffle (which will continue to serve me when excercising), especially having my entire music library and all the podcasts available at whim. Nonetheless, I didn't order it for the music.

I ordered it because it looks like a good portable computing device. No, I don't intend to program on it. I intend to read ebooks on it like I did with my ancient Palm Tungsten E until it passed away. I intend to finally organize my life in some sort of calendar (maybe I'll finally know what happens with me in the weekends). I'll definitely look into some GTD organizer. Some Japanese learning app will definitely find its way in there. I'll probably think of some other useful uses.

And that's the reason I'm buying the touch - because it is extensible. I'm sure a year from now I'll find a dozen more good uses for it.

Too bad it doesn't have a camera...