Conservatism

There are many implicits about being a geek (at least to others), and as such there are a few we just love to foster: we are savvy, we are on the edge, we see the world in a different way…

I must admit, one of the reasons why I went into computer science is because it’s such a broad field to explore. We are the new explorers, discoverers, inventors. Being a freelancer is one more step in that direction: freeing myself from the shackles of other people’s decisions, being a Captain Cook, rather than a Columbus.

And yet, every now and again, I take a conservative stance that horrifies me afterwards. And very often, I have to face it in others.

Look. The code you wrote 10 years ago, and that was such a breakthrough, is crap, by today’s standards. Even if it’s only 5 years old. Even if it’s one year old. Let’s be honest here, if you had to rewrite it today, you’d do so much better. And I’m not saying reusability is bad, just that this critical part of the thinking has to be somewhere in the decision as to how to do things.

And it’s hard. Something we do quite naturally when we have to start something over is completely overlooked when it’s about changing something.

Let’s take a detour. When I had to come up with a training regimen with my heavy staff, I took everything into account: my work schedule, my then-girlfriend schedule, the days I wanted to keep free for other things, and so many other variables. I pondered about it, talked about it, and made my decision.

Fast forward 5 years, my training regimen is shot to hell. The girlfriend has gone, my customers are geographically far from each other, which forced me to get a car, I don’t necessarily hang out with the same people, so the days I would like to be free have changed. Yet, instead of changing my schedule, I work around it. And as a result, I don’t train well, because I skip, I shorten the session, I feel guilty, so I schedule a new one that’s longer. It is a mess.

For code writing, it’s exactly the same. Some ways we do things are highly subjective. We take a decision, because at that point in time, it feels like the best possible decision. A few years later, when the time comes to reuse something, more often than not, we don’t even think that part or all of these subjective choices could, maybe, you know, change.

If it ain’t broken, don’t fix it.

Well, maybe not. We don’t start from the ground up every single time, that’s obvious we would go nowhere, and really fast. We need to be able to build on top of something. But why not take a few minutes to at least think about it?

They say we are hard-wired for habits. Once something is labeled good, it’s so hard to resist the temptation. And if it’s bad, it’s even harder to go back to that place again.

That code you’ve spent a month writing, that cost you so many sleepless nights, and so much pressure? No way you’re going to stick a finger in that hornets nest again! And dude, it’s soooo easy to use that code now that it’s been debugged and honed. So, this gets us coming and going.

So what if it doesn’t do exactly what I need today? I’ll just use a workaround. And another one. A year from now, the amount of workarounds exceeds the number of genuine uses, but hey, it still works, right?

Now someone else has to use it. So I’ll just hide the most glaring problems under the rug, make it look like it’s been designed that way at the beginning. After all, it still works right? Ok, ok, to make it sweeter, I’ll add a couple of freebies in there that look really cool, how’s that?

A year later, I have completely forgotten why the workarounds are there. It still is kinda good, anyway. I’ll rewrite it from the ground up someday, I know I will. Just not today, because today I don’t have time. Only now, this piece of code is in use in a dozen other projects, so if I rewrite it, I’ll have to update them all. Another reason why I’ll do that retooling when I have plenty of time.

Except it’s now another year, and it just doesn’t work anymore. There still no time, but now I have to fix it. And yuck, man. That piece of code is utterly crappy. How in hell could I think this was genius? I don’t even understand how half of it works. Wait! I thought I fixed that bug years ago! Maybe in another version? So I look over all my backups and compare them. Maybe by adding together all the changes I’ve made for this or that project, I’ll end up with a workable solution? Right? Done it once, can do it again.

A month later, defeated, I rewrite the hundred or so lines of code that should be working. And you know what? It works so much much better now. Maybe I should package it for reuse? The way it is now is just bloody genius!

That’s why it’s called a revolution: it just goes around and around. What if being lazy was to stop and think about the why every now and then?

  

Leave a Reply