Code Quality

Over the time the code that we're writing undergoes (or is supposed to undergo) a tremendous change in quality. Just for fun I recently rewrote my ancient GIF image encoder/decoder the way it should've been written. I took into account most of the things that were wrong with the initial implementation and the new version turned out to be:

All of the changes were influenced by the experience gained during several (5+) years of professional development of software in C.

Compare side by side:

Old code (from around 1999)New code (2007)

A few comments and observations:

So, as you get smarter and more serious about the code you write, you should be seeing a similar transformation. If you don't see it happen, then either you're not getting smarter or you aren't any serious about the code quality - you just plain don't care. The latter is sometimes OK. For exameple, the code is temporary; it will be used once and then thrown away. Or there're some guarantees about the inputs and you don't need to be validating everything scrupulously. But we all know it probably too well: our judgement isn't perfect and assumptions aren't always right and just like there's nothing everlasing, some things that we intend to be temporary solutions (aka quick and dirty hacks, workarounds, kludges and so on) end up being used for a very long time, which may make us unhappy in the end of the day.

Alexei A. Frounze
Feb 2008

Hosted by uCoz