Wednesday, October 8, 2025

Code Autopsy

A few months ago, I wrote a post about the new computer system we got at work.  Since the post was titled New and … worsened, you can probably guess that I had issues with it.  It seems that for every one thing the new system does better than the old, it does like ten worse.  And some of the worse things it does is, kind of odd.  Which is nice since it gave me another idea for a post.

To begin, I have to describe two things the new system does.  The first is it counts the money in the till.  This is pretty straightforward.  At the beginning of each shift we enter the amount of money in the till, and it just has to add on whatever we take in and subtract whatever we give out.  And when we get to a point, say twice what we started with, it pops up a message saying we have to do a drop.  To start the next transaction, we have to tap “Okay.” (An example of how the new system is worse, in the old system to do a drop I just had to hit like two buttons and enter a four digit code.  Now I have to hit like five buttons, and enter a dozen digit manager code.  So instead of doing three or four drops a night, now I just do one when I go on break.)

The second thing I have to describe, is we print a coupon on each receipt.  But instead of just having one coupon code THAT WOULD MAKE THINGS SO MUCH EASIER, each coupon has to be unique.  Meaning, for each transaction, our system has to call up the corporate system and ask for a unique code that will be recognized at every one of the thousand or so stores across the nation.  But sometimes, there’s a bit of a glitch somewhere in the system.  Either the corporate system is down, or there’s some communications issue, or whatever.  So the system will wait five seconds or so to see if it clears up, but if it doesn’t it will just print the receipt without the coupon.  Which makes sense since you don’t want the customer to just wait there for five minutes waiting for the problem to fix itself.

So those are the two issues I want to discuss.  Now, you’re probably thinking these have nothing to do with one another.  And you’d be right, except there’s something weird with our system.  See, if the communication system is down for whatever reason and the coupon isn’t printed, the “You have to do a drop” message won’t show up.  The first few times it happened, I figured I was missing something.  But communication glitches seem to happen two or three times each shift, so it wasn’t long before I noticed that these two things were somehow connected.  It took me a while to work out how they were connected, but I think what happens is there is a series of things the computer does after a transaction to set things up for the next.  And I think one of the last ones it does is to see if it needs to put up the “You have to do a drop” message.  But for some reason, when there’s a communications glitch, it ends up skipping the “Drop_Check_SubRoutine” or whatever.  It’s probably just one line of code that needs added, or fixed, that whoever designed the code never noticed because it worked 99.999% of the time.

All of this brings me to the idea behind the title of this post: Code Autopsy.  I’m sure that every corporation that has proprietary code for their stores/restaurants/warehouses whatever, there are lines of bad code that lead to weird/annoying/stupid problems that employees have just had to learn to live with.  Code Autopsy would be a show where a group of experienced coders are told of these problems, and then they go through the code to see what causes them.  And then, they see how to fix them.  Like I imagine the coupon/drop issue our system has could be fixed with one or two lines of code.  That’s probably all it would take.

Of course, there are several problems with this idea.  First off, few companies would be willing to have their code issues discussed in public.  They’d probably claim “proprietary” reasons, but really it would be the PR black eye of letting the world know they have “bad code.” Secondly, while this is my idea, I’d likely only watch the episode for the company where I work.  It’s an interesting idea, but not one I’d really be invested in.  Unless there’s a really big company with really fucked up code, it wouldn’t be a huge draw.