Sync’ up! … without getting drained

mar 27

Kludge kingdom

I hate using kludges. Whenever I do, some part of me says: ‘I’m a hack; a failure.’

But kludges have their place. When moving fast trumps beauty, or when the bads outweigh the immediate good, kludges come in handy for sure.

Two animals

I don’t know if anyone has ever studied kludges, but it’s apparent to me that kludges fall into two camps: they can either be cat kludges or monkey kludges.

In the feline case, an unsophisticated solution has been put into fruition, and voila, for whatever reason, everything seems to just work!

In the case of of monkey kludges, there is a clear understanding how the kludge would work, and with some fitting, and re-fitting, the kludge holds the dam.

(These animals are quasi random, but I favor these as cats have no thumbs — and presumably are less agile because of this — whereas our fellow monkey bears thumbs which is at least an order of magnitude better equipped.)

Software

I hate to admit it, but most of my larger software projects sport cat and monkey kludges. Typically, a comment in the code will alarm code-passerbys with something like ‘OPTIMIZE,’ ‘FIXME,’ ‘XXX,’ or ‘TODO.’ I think all of these typically fall into the monkey kludge camp, at least for me.

However, if I find a fix that I have no idea why or how it works, then sometimes I will chain every warning pylon I have at my disposal and stuff it in there as follows:

%%%% XXX TODO FIXME -[/%0//]-
%%%% I have no idea how this works

This is usually a terribly bad sign for my future self, or any coder to come along.

I’d like to say this pattern doesn’t come up too often, but if I was honest, some of my best projects have quite a few cat kludges in them.

Criminal

I have written how upstarts need to move fast, and by doing so, kludges should be used to leverage forward momentum. And as I revealed, this leads to certain discomforts from an aesthetic vantage point. And of course, beyond aesthetics, kludges contribute to technical debt right out of the gate.

(Technical debt is a monster in itself, whereby not enough discipline in the code-base can make a bug-fix down the line sometimes impossible. I’m reminded of a Microsoft Word bug that Alan Kay mentioned in a talk, whereby there was no solving it, because the sheer lines-of-code to consider alone, made solving the bug economically unpalletable.)

However, I think if one balances just the right amount of kludges in any flavor of software project, then half-assing code from time-to-time is acceptable.

Of course, code conscientiousness if different from person to person; I probably fall too much on the ‘no kludge ever!’ side of the spectrum, so for me, I actively have to work to allow for half-measures more than most.