Today's Programming Embarrassment

(NOTE: Based on time elapsed since the posting of this entry, the BS-o-meter calculates this is 6.03% likely to be something that Ferrett now regrets.)

So as it turns out, I had a database that was missing critical data.  It was possible to “fill in” that data from other sources, as this was a rarely-used database, so I did what programmers since time eternal have done: I whipped up a script to fix the problem.
But after running the script, I discovered that the quick-fix script had only filled in about 90% of the necessary data.  Investigation showed there were edge cases that needed some special handling – and so I changed my script to handle those special edge cases and ran it again.
That got us to about 97% completion.  But – you guessed it – there was a tricky 3% that needed to be handled with an entirely different method, so I changed the script to handle those edge cases, reran it, and got us to 100% completion.  Awesome!  We fixed the problem!
Now, months later, the database has grown, and once again it is missing critical data.  Normally, this would be a trivial fix.  After all, I’d already filled in the data!  I can just take the logic I’d created in that quick-fix script, apply a filter so that the critical data is filled in whenever a new row is inserted, and have things up and running within an hour or two!  We’ll fix this lack of data forever!
I didn’t actually save that first script.  I just kept saving the old script, modifying it to handle the current edge case, and re-running it.  So what I have now is not the script that fixes 90% of the data in one run, but some messed-up tangle of code that handles a 3% edge case.  What happened to the 90% fix logic I created?
Well, I saved over it.  Basically, I deleted it in stages.  So I’m going to have to recreate all that logic from scratch today.

1 Comment

  1. David
    Sep 16, 2014

    Proof that your main app codebase isn’t the only thing that needs to be in version control. 😀

All Comments Will Be Moderated. Comments From Fake Or Throwaway Accounts Will Never Be approved.