For those of us who can readily admit that there are areas where we personally could use improvement, I present a simple idea based on archetypes from martial arts. Now, let me first of all state that while I’ve done a good bit of boxing, I am NOT a kung-fu master, so I am making relationships from nothing but my extensive time watching bad Hong Kong Cinema kung fu movies. If I blow the metaphors out of their original context, you’ll just have to excuse me.
Anyhow, code-kata is not a new concept. It’s actually a pretty solid idea, that by practicing something, you get better at it. Almost everything works like this, and I think that kata styled programming is an excellent way to stay sharp on what you have learned.
That being said, I’ve watched enough kung-fu movies to know how the student eventually learns the secret technique that he needs to defeat the super-awesome bad guys and/or evil dragon-style master who killed his family. He goes to the mountain or temple, meets an unlikely hermetical master (often a drunk), and through repeatedly failing learns some secret technique that allows him a leg up on the competition. Sometimes, he/she will see a mantis fighting a spider or something, and then ‘pow’, inspirations strikes. There is a moment of enlightenment where all of our hero’s weaknesses have been addressed because after the regular training, he was sitting quietly and contemplating something.
I would say that this is the step that kata often ignore, and for the sake of this discussion, I’ll call this the ‘tai chi’ approach. It’s not the movement itself, but the repeated introspective practice followed by meditation on the subject that allows us to have the insight to rise above our current level. I am not by any means suggesting that you wear silk robes to work and burn incense at your desk (unless your boss is fine with that, in which case, by all means…it seems like it would be pretty comfortable.) What I am suggesting is that if you do use kata of some kind, to do so with a thoughtful presence, closely examining each step. How could you make it better? What is really happening behind the scenes? Is there another way to do the exact same thing?
Often, it’s only after I’ve finished a project that I’ll look back and realize the problems with my own methods. There is almost ALWAYS room for improvement, and by spending more time looking at the small parts of the small projects, the bigger projects are easier and more concise.
I’m not saying that studying is a replacement for regular practice, but that BOTH are necessary to reach enlightenment…and by enlightenment, I mean when you can spot a segfault in three-star pointers at a glance (or whatever your language of choice has to offer.) In the end, it is the practice of solving problems that leads us to find the answer when we are finally able to still our busy minds.
“It took me ten years to discover my chi, but thirty years to learn how to use it.”
– Ma Yueh Liang