Bone’s Great Code Cleanup

Bone arrived from a respectable digital consultancy, lured away by a rag-tag bunch of startup geeks.

His tall stride made him the most elevated person in the room. His hawk-like gaze down a chiseled nose meant business.

He came for battle, ready to bring the first-ever digital workspace collaboration tool to life in glorious PHP. He planned to convert T&E into something sexy, with an application well before its time in the late ‘90s. 

His armaments included music of all eras, to keep the cramped production room hopping. Often dueling in the air with 1940s Swing from colleague Presto.

Bone understood his assignment, and stood ready to dive in.

But to his surprise, Day 1 slammed him with a different task: entanglement in a staff departure fiasco. The proverbial “review this other guy’s undocumented code and figure out how it works”. A favorite task of developers, before “code refactoring” became a way of life.

Ugh… better get out the AC/DC, he thought to himself, needing a caffeine jolt. Bone peered down his nose at the tangle of ASP code on his monitor.

Within moments, something caught his attention amid the green lines of the shopping cart system:

If Erica = A Bitch

What the hell is going on here?, Bone thought and winced as he scratched his head. And why did I take this job?

Knowing a little something about the departed programmer, Bone was unsurprised by his passive-aggressive animus toward an ex-girlfriend. But to find it in client code and subsequently have to clean it up? — oh boy.

Ok follow the trail, Bone. Sleuth this sucker.

If Erica = A Bitch, then pull library functions… 

Ok, there’s a variable “Poop Cookies”… 

Uhh… Poop Cookies? What?

Woah, there’s a giant set of if/then conditions in “Poop Cookies”… 

Dig, Bone, dig.  Get into this guy’s head.

If Erica is a Bitch, then the shopping cart is in a foreign currency…

Then, look at Poop Cookies to determine exchange rate and shipping defaults…

Almost there, Bone. Keep looking.

If Erica is not a Bitch, then it’s US Currency…

So ping USPS module for shipping info.

TaDah! Mystery unraveled, and all before the second cup of coffee.  But eww, what an utterly gnarled mess on so many levels.

Now what?, Bone pondered, remembering a similar techie atrocity and the consequences if ever found by the client.

And so continued the Wild West coding practices of the early internet… hidden in digital bowels (literally)… pre-“Me Too”. No wonder we have code reviews, nowadays.

Time for a clean-up on aisle 9, Bone concluded. 

As always, I hope you enjoyed this and it brightened your day.

Please “like” if you did on social media (@DigitalDeliria), share, and post your comments. What inane coding atrocity have you come across?

Don’t want to miss a future story?  Be sure to sign up for our mailing list.