Saturday, July 23, 2005

Just For Fun

I recently read Linus Torvalds's Just For Fun. It was a nice read although towards the end it gets a little boring ( as it talks about the politics of open source). Here are few lines I really liked.

Programming the right way:

You can do something the brute force way, the stupid, grind-the-problem-down-until-it's-not-a-problem-anymore way, or you can find the right approach and suddenly the problem just goes away. You look at the problem another way, and you have this epiphany: It was only a problem because you were looking at it the wrong way.

A great mathematician doesn't solve a problem the long and boring way because he sees what a real pattern is behind the question, and applies that pattern to find the answer in a much better way. The same is definitely true in computer science, too. Sure, you can just write a program that calculates the sum. On today's computers that would be snap. But a great programmer would know what the answer is simply by being clever. He would know to write a beautiful program that attacks the problem in a new way that, in the end, is the right way.

It's still hard to explain what can be so fascinating about beating your head against the wall for three days, not knowing how to solve something the better way, the beautiful way. But once you find that way, it's greatest feeling in the world.


Simple is beautiful:

One of the beauties of Unix is realizing that you don't need to have complex interfaces to build up something complex. You can build up any amount of complexity from the interactions of simple things. What you do is create channels of communications (called pipes in Unix) between simple processes to create complex problem-solving.

Unix comes with a small-is-beautiful philosophy. It has a small set of simple basic building blocks that can be combined into something that allows for infinite complexity of expression.

This, by the way, is also how physics works. You try and find the fundamental rules that are supposed to be fairly simple. The complexity comes from the many incredible interactions you get from those simple rules, not from any inherent complexity of the rules themselves.

And you should absolutely not dismiss simplicity for something easy. It takes design and good taste to be simple. You should not confuse the simplicity of Unix with lack of sophistication- quite the reverse.