Thursday, February 26, 2009

The Tao of Software Development

In the pursuit of knowledge,
every day something is added,
In the practice of the Tao,
every day something is dropped.
Less and less do you need to force things,
until finally you arrive at non-action.
When nothing is done,

nothing is left undone.

-- Lao-tse*

I know my college Chinese professor will be laughing her head off if she knows I am reading Lao-Tse (and her beloved Chuang-Tse) through the English tranlation of someone who doesn't even know Chinese. Well, since Tao is "unnamable", "undescrible", who knows the English translation is not truer to the Tao? (Also, if my college professor can be a huge Dostoyevsky fan without knowing any Russian, why can't I read Lao-tse in English? After all, I can always go back to the original.)

Back to the topic. When I read the chapter 48 of TTC, I suddenly realized, Lao-tse was actually talking about software development! Think about it. When we start learning software engineering, we start by learning basic data structures and algorithms. As we become more knowledgable, we add more and more complex tools (data structures, algorithms, languages, design patterns, etc) into our tool box. However, when you are doing software development, if you just keep adding complexity, pretty soon you will have a chuck of unmaintainable code or a very tangled architecture that is out of your control.

So what do you do? Well, you simplify it, you take away things. That's the essence of refactoring. That's why we have design patterns (and why you need to know how to use them wisely). After you have cleaned up you code, used an easier to understand yet more efficient data structure or algorithm, seen the patterns in your code and made them flexible, after you have done them again and again and finally nothing can be done, you know it's the time you put it down. It is time to move on. You may have to revisit it someday, but there's nothing you can see or do now. Some day, you may have a new metaphor, a paradigm shift, which allows you to see the problem in a different light, to find a solution even simpler, but until then, you are done with the work, nothing is left undone.

Such, is the Tao of software development.

*This is from Stephen Mitchell's translation of "Tao Te Ching", the most readable and enjoyable English translation so far. Mitchell had some Zen training, so his "unfaithful" translation is actually a mix of Zen Buddhism and Taoism. However, whatever his translation loses in authenticity, it gains from his poetic use of the English language.


No comments:

Post a Comment