It's a particularly busy week for me: on top of a few looming deadlines, I'll be at Business of Software 2008 in Boston. So, I figured it'd be the perfect opportunity to revisit some classics.
The Phantom of The System was originally published on August 2nd, 2005.
Mortimer Armstrong and his coworker had always known about The System: a gigantic order entry/processing applications written entirely in ASP/VBScript. The System was so fragile that something as simple as a misplaced "double-click" could bring the whole thing down. The code churning within The System was so intricate and complex that only "The Whiz" (who, consequently, was also the author of The System) could possibly understand and maintain it.
After The Whiz had left the company, The System fell into Mortimer's coworker's lap. Amongst countless other things, one thing that he was having such a hard time figuring out was the significance of the mysterious numbers 22, 7, -12, and 620 strewn throughout the code. Then he found this. Amidst 1600 lines VBScript order validation/processing code. With not a single line containing anything even resembling a function or subroutine.
'ED: Yes, these are the original comments ... ' This code will calculate order total, mask it, and send it to ' the ThankYou.asp page, where it will then be unmasked to reveal ' its true beauty, just like the poor Phantom of the Opera. Randomize amount = oTotal maskerLeft = Int((999999 - 100000 + 1) * Rnd + 100000) maskerRight = Int((999999 - 100000 + 1) * Rnd + 100000) ' this will be used as a dummy, to throw off the wise ' it calculates nothing maskerDummyLeft = Int((999999 - 100000 + 1) * Rnd + 100000) maskerDummyRight = Int((999999 - 100000 + 1) * Rnd + 100000) maskerDummyMid = Int((999999 - 100000 + 1) * Rnd + 100000) maskerDummy = maskerDummyLeft & maskerDummyMid & ".50" & maskerDummyRight ' takes order total and jumbles it mathematically maskerAmount = ((((oTotal + 22) * 7 )) - 12) * 620 ' adds random numbers to the left and right of amount ' this var is sent to ThankYou.asp track = maskerLeft & maskerAmount & maskerRight ' ED: Snip Response.Redirect("ThankYou.asp?ft=" & form_type & "&tempid=" & tNumber
& "&track=" & track & "&tot=" & maskerDummy)