small code

Small code is better than big code.

Big code means big number of bugs.

And big number of hours/days/weeks/prayers to find and fix bugs.

The problem with most programmers is they implement something because they can, or because someone asked for it. "Oh, I am so clever, I thought of this idea, and I was able to implement it."

Good programmers have some self-restraint, and only implement something which is (a) absolutely critical for most users and/or (b) very easy to implement (with small code which fits in nicely with the code architecture) and very easy to understand and use.

A few years ago, I started working with someone who was a key designer of one of the most successful software products ever built. I really liked this guy immediately, and we became fast friends to this day. But when I had started working with him, I thought that he seemed to not be able to understand my design ideas. Every time we brainstormed a new feature, we'd walk away, and the next day he'd show me his implementation, which always had less than half the functionality we discussed.

I wondered if he was slow or something, and could not understand the subtle intricacies of my elegant design.

But it turned out I was the one that was slow. It took me months to realize that this guy was the brilliant one, as he built code that could be used by anyone.

His philosphy was that if someone didn't understand how to use something, it should be removed.

That seems kind of harsh. But his products have been pretty successful.

He also believed that if his competitors snuck into the building at night and looked at his code under development, that they would be rolling on the floor laughing in hysterics at how naive and limited his code was. They might even be hospitalized from gleefully slapping each other on the back so much, in their joy of knowing how much their fancy product was going to beat his simple code.

Until months later, when both products were released, and his would beat theirs by an order of magnitude in number of customers and revenue.

So I've started developing this passion for small code.

For example, when I find some code on the net that someone says is cool, I actually look at the download size. If the total program size is about 300k, I think to myself that it just might have been created by a programmer with discipline, who worked hard to make something simple. If I see something that is double or triple digit megabytes, I decline the download with furrowed brow.

It is funny how most Windows PCs seem to die after a few years, and need to be replaced.

Guess what? I'll tell you a secret. The PC does not rot. The memory chips do not stop working. The disk drives usually do not fail.

The real cause for the death of old Windows PCs is their owners install too much big software (and Microsoft software is not great).

See Also - articles - startups - nonprofits - press 05-Apr-2010