Debugging source is even harder when you can't stop laughing at it
Forgive the self-taught Visual Basic programmer, for they know not what they do. Or do they?
Who, Me? Thank goodness for code reviews. However things weren't always so squeaky clean as one Register reader discovered while attempting to sort another's sweary source. Welcome to Who, Me?
This morning's story comes from a reader we shall call "Philip" (for it is not his name) and takes us to the 1990s when he was working for a company supplying color printers and scanning hardware.
Such devices were almost impossibly exotic back then and required all manner of upgrades to a vanilla PC in order to work. A full-length AT card was usually needed to provide the raw grunt that we take for granted these days.
As was so often the case, the cards occasionally failed and had to be replaced. A manual card index was used to keep track of things as broken hardware arrived and working kit was sent out. It worked about as well as you'd imagine. "We were quite proud if we only lost a few items a month," said Philip, "but management weren't quite so impressed by our finely honed skill."
However, the operations manager had contacts in the US and managed to secure the services of a student for six months. "Brad" (also not his name) would come to the UK on what Philip now reckons looked a bit like a modern zero-hours contract and do various work experience at the facility.
"He was an enthusiastic employee and took it on himself to learn enough Visual Basic to make a rudimentary replacement to our card index."
Like all too many quick and dirty Visual Basic/Access mash-ups of the time, it seemed to work pretty much perfectly after a few iterations. So much so that the business came to depend on Brad's work and the old manual filing system was filed in the bin. Brad eventually returned to the US, but the fruits of his labor lived on after his departure.
"After some time – I forget what caused it – an update was required to Brad's hard work," recalled Philip, "and we, the lads who were reasonably proficient at working at code level, were asked to break open his source and make the change."
"This is where things started to unravel."
- The IBM System/360 Model 40 told you to WHAT now?
- Prototype app outperforms and outlasts outsourced production version
- IT blamed after HR forgets to install sockets in new office
- IT advice fuelled by beer is the best IT advice of all, right?
Brad was a self-taught programmer, and the company had no concept of coding standards. Variable and function names that might be meaningful to his successors were an alien country to him. Instead he had used pretty much every offensive word he could think of as well as a good few we suspect he picked up from his UK colleagues.
"Scope" was also a concept with which Brad was unfamiliar, meaning that the swears might be global, local, and pretty much anywhere in between. His grasp was, as Philip put it, "variable at best."
We see what you did there.
As for the code, Philip and his team were left trying to work out what a function with a name that rhymed with "Chugger" - that took parameters more usually associated with bodily functions and body parts - actually did. "And that's just a reasonably printable example," he added.
Thanks to the puerile sense of humor of the team, coffee was often spat onto keyboards as the source was picked through. "All that laughter makes debugging code exceptionally difficult, believe me!" explained Philip. "If you've ever tried to debug an array of *****, or loop through ****, you'll sympathize."
"It took weeks of re-engineering to make sense of Brad's work," said Philip. "I lost touch with him but I sincerely hope he got a job with a major software vendor. That level of dedication needed to be recognized by someone."
And now it has. Today we have code reviews as part of many a DevOps process that should – we hope – mean that Brad's naming conventions will never again see the light of day. Or do you have a dark secret? A bit of code that revealed where your mind was wandering? Confess all with an email to Who, Me? ®