Every now and then, my job throws me an interesting curveball which spins a little further than anyone would have expected. We have a test rig for running certain specific tests on a specific subcomponent shipped from abroad in order to make sure they're not faulty. No one knows what it does in anything but very broad terms, and there is no documentation whatsoever. Furthermore, it can only be run from a single laptop which we can't update for compatibility reasons and can't hook up to the rest of our network for security reasons. In fact, the only thing we have is the source code. In Visual Basic. Dating back to before .NET. And there's basically no separation between GUI and back-end code. Drek.

Having toiled away at this code for a week now, though, I'm starting to get a hang of the general structure, but that also means I'm starting to uncover the truly atrocious programmer sins. The greatest evil, found to day, is an enum1. This enum described a memory address, and all names would describe a value in the high millions. This enum was used for one variable in a subroutine I was interested in, and that variable was assigned... a "1". There's no 1 among the defined names for this enum, nor is 1 a valid memory address. And it's just passed into the still unexplored murky depths of the program, so I don't know how it's used either. If this would have been some murky backwater file, I would just have declare the code to be bugged and assumed it wasn't ever executed, but this code is called all the time. My mind is boggled.

Unrelated to this evil, I showed my boss the code for these tests, and he forbade me from mentioning it to my friends, because if it got out we have to work with Visual Basic, he would never be able to hire anyone again. I tried to blackmail him into giving me a pay raise, but he didn't fall for it.

1For the non-programmers, an enum (or enumeration type) is a way to say specific numbers mean specific things, so you can use the name instead of the number in the code, thus increasing readability and reducing the risk of errors. For example, I could make the months of a year an enum, so instead of using "1" all over the place to mean January, I could just write "January" and the computer will resolve the value for me.