Monday, March 30, 2009

New blog

Like birds and wild animals? Like looking at dead things? Well, Lisa has a new blog up so I recommend you all go read it.

http://duck-is-a-4-letter-bird.blogspot.com/

Saturday, March 07, 2009

New term to describe bad programming: Biological


Quick quiz: what does the pancreas do? That's a trick question. It does a whole bunch of things. It secretes hormones into your blood and makes digestive juices. It also secretes insulin that regulates sugar. For all I know its probably also an email client.

The pancreas is probably pretty efficient at what it does. But it still represents the product of a system that has little respect for architectural planning. The development process (evolution) consists of randomly tweaking past implementations and then running them past a very thorough QA process (seeing if it dies). This is why scientists still struggle to understand how the body works: it respects no rules but those imposed by the hardware - no structure except that provided by the vagaries of history - and no order whatsoever.

When most people first begin programming their code is both badly architectured and poorly implemented. I know mine was. But while most developers quickly appreciate how a better implementation can help their code fewer appreciate architecture. Consequently many misdirect their efforts at self-improvement and end up writing poorly architected code with better and better implementations. In essence, the code becomes more and more biological - but that's not the same as good.

Good code strives to be boring and to be structured. Learning good code is easy because it's so organized. Modifying it easy because it's clear what each part does. Parts that do separate things (like digestion and hormone production) are kept separate. Even if it means a little inefficiency seeps in. A good developer would never put the end of the digestive system right next to the start of the reproduction system - not even if that would require fewer lines of code (which it undoubtedly did).

The point is: software isn't biology. Unlike Mother Nature software developers can take time out to architect their code before they start and re-architect it when changes warrant it. Let this be a lesson to you!