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.

Noodling Logic
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)
  switch (i0)
    case -1:
      return STXTGH(i2);

    case 920:
      return SFFMAB(i1, i3);

    case 1222:
      return SHBGER(i1, i3);

    case 824:
      return SGXECB(i4);

    case 3:
      return STXGMB(i1) + STXKSB(i1) + STXNRB(i1);

      return 42;

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.

Mea Culpa
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.

comments powered by Disqus


  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube