The Spaghetti Code Incident
Henry was the TAXCALC king. But his coding skills were positively peasant-like.
By the sound of the tumult, you would've thought the fifth floor conference room was filled to capacity -- but actually, it was just Nicolas and a very angry developer named Henry.
"What business do you have not approving the production deployment?" Henry shouted as he pounded his palm on the long wooden table for emphasis.
This peer code review was going to be one for the books, Nicolas thought as he massaged his forehead.
"See? Here are the test cases I ran," Henry shrieked. "Management has already signed off on TAXCALC!"
Nicolas tried to interject, but it was of no use.
Henry rose and yelled, "You, sir, are an ignoramus!"
Then he huffed out of the room, upsetting his stack of test cases in the process.
The TAXCALC program was born as a FORTRAN program on the corporate financial services mainframe. The original developers were hackers and risk takers -- self-taught, self-governed, rewriting computer programming theory as they went.
By the time Nicolas joined the company, most of the original developers had already moved on, leaving Henry as the designated "TAXCALC king." As such, when it was decided that the time had come to move off of the mainframe, Henry was upgraded in the process.
He received a refresher in modern IT: classes in relational databases (unknown on the mainframe) and .NET programming in general. Henry took to C# quickly and used it to port TAXCALC to the 21st century.
Despite learning some new tricks, Henry's peculiar FORTRAN programming habits carried through to the new version of TAXCALC in functions like this:
static int STRTXG(int i0, int i1, int i2, int i3, int i4)
return SFFMAB(i1, i3);
return SHBGER(i1, i3);
return STXGMB(i1) + STXKSB(i1) + STXNRB(i1);
During his review, Nicolas found that TAXCALC was a single source file with hundreds of functions weaving in and out of each other. Magic numbers (or perhaps they were lucky numbers?) prevailed throughout. The only constant: Every function name was six characters long and began with the letter "s."
It was a surprise that the system worked for more than a couple of minutes, but for Henry, doing things this way was perfectly normal.
Henry apologized to Nicolas the next day for his reaction during the code review. He said his passion was to blame for his lack of common sense. In response, Henry was given a chance to take another shot at TAXCALC, and management kicked in the offer of some additional training specifically related to object-oriented programming.
A week after returning from his training course, Henry finished his changes and, based on how he greeted Nicolas, was eagerly awaiting his next code review.
"I made tons of improvements! Believe me, TAXCALC is better than ever!"
Nicolas politely nodded in acknowledgement, but internally, he was trying to quash his fears of what "better" really meant.
Just as Nicolas started to feel a bit of stomach acid tickle the back of his throat, Henry said: "Yeah, the instructor gave the class in Java -- what a great language! That's what the new TAXCALC is written in!"
Henry beamed ear to ear with pride. But it was Nicolas who was really delighted -- he wasn't involved in the Java peer code reviews.
About the Author
Mark Bowytz is a contributor to the popular Web site The Daily WTF. He has more than a decade of IT experience and is currently a systems analyst for PPG Industries.