Never a Masterpiece

if [[ $i =~ .*%.* ]] && [[ ${i/\%/} -gt “$crit” ]]
then
echo “Critical: $previous is $i used $timestamp”
exit 2

So, I’m banging my head against a coding problem this morning and I slog on through to the end, it’s a fancy piece of fluff that doesn’t amount to more than 20 lines, but it does what is needed, and yet in the back of my mind I can hear across the ages… Doris Jensen is yelling, “Are you with me?!” from back in high school, telling me I shouldn’t be jumping out of the program at that juncture. The code works, and it’s just a bit of a hack anyway. But I can see the way to finish the code. It just takes storing the result and letting the conditionals finish. And I’ll have to set up an upper limit test for the warning, but I can see it, and it will only take a couple minutes.

The whole thing kind of glows in a golden light, the GOOD CODE. I know it’s right there and can knock it out real fast, but what I’ve got works and won’t fail, but it’s just kind of kludged together. It’s not glowing in the golden light. Maybe it’s glowing a bit in some sort of black light. It’s proud that it will fail critically first, and then warn next because of jumping out of the loop you don’t need an upper boundary for the warning, but you can kind of still see the mustard stain.

In my mind Mrs. Jensen yells again.

At least it’s not obfuscated for the sake of preserving my job. I had a mandate, once, a long time ago to follow some coding rules I didn’t agree with which required rewriting functions with aliases which referenced other functions which were aliases… And, it’s true, I did get laid off from another job because my scripts made me superfluous once others learned how they worked.

But I have learned to look critically at bowls and put them back on the wheel to take that last 1/16th of an inch off the bottom to make it feel lighter, and I cut a new board if I take a little too much off the one I just cut. I wondered for awhile if it’s just because computer nerds are supposed to be lazy, and there’s something gratifying about ‘getting away with it’.

Or maybe it’s that there’s not actual physical material involved. Nobody is ever going to see this code, and I’m not kidding here. It’s a bit of monitoring that may be scrapped for a better system in a few years. I’ve written code for a bank that some friends say may still be in existence fifteen years later. I bet nobody ever looked at the code.

But if they did, they’d see some fine haiku documentation.