Friday, November 25, 2005

Unseen Work

So long without an update! I've been a bad boy. Oh yes. I need a spank. Oh yeah. Right ther...oh hi. Sorry.

It's ultimately a good thing but I hate it when a chunk of my work goes unseen. First the down side. Let's say I'm working on a piece of code (as I have been) and I continually find different ways to perform the task/process I want. So after a week of exploring different options, I'll come upon a solution that takes fewer lines and is more stable than all the pasghetti code I've written. Why is this bad? It's not, but for purposes of vanity, if anybody were ever to look at the code, they might "wow, this isn't so hard. It's just invoking these couple of functions." But see, it IS hard. Don't you see, dammit, that it took me an entire week to find those functions!

On the other hand, it is good in the end. A generalization of Occam's razor does work in most cases: simpler is better. Why do

int i = 0;
while (i < 5) {
DO_SOMETHING();
i++;
}

when you can do

for (i = 0; i < 5; i++) {
DO_SOMETHING;
}

right? So in the end, the simpler and more logical solution is better but it doesn't show the sweat and toil that it cost you to get there. But perhaps this is the case for a lot of people and the next time I see elegant code, I shouldn't think "That wasn't so hard" and instead "I wonder how much knowledge and research it took to find such a simple way of doing things."

No comments: