Article 4C06A The Blanking Blank

The Blanking Blank

by
Remy Porter
from The Daily WTF on (#4C06A)

Since the dawn of software development, people have endlessly been searching for a way to modularize their applications efficiently. From the "do one thing and do it well (and also everything is text)" protocols of Unix-style command line tools, through to modern microservices, the key idea has always been to have simple, easy to understand components which interface in simple, easy to understand ways. Complex things are built from piles of small, tiny things.

Matt W was working on one of those simple modules in a Big Complicated Thing. The Big Complicated Thing was an enterprise "do everything" tool, and like most enterprise tools, it was larger and more complicated than it needed to be. Also, everything talked to everything else in XML, the most enterprise of cross-component interfaces.

Over the decades of continuous development, components had proliferated, interfaces had ball-of-mudded together, and seemingly arbitrary silos created boundaries where they didn't make any sense. To wit, Matt needed to build a report out of the contents of some server-side session variables. Those session variables were populated by another component, which fetched the data from yet another component. Worse, many of those variables were optional, but despite using XML much of the data was stringly typed. Which meant, during testing, Matt saw this in a report:

Bill Lumbergh, null for Initech

Matt's code dutifully checked for empty strings and actually null strings, but hadn't been prepared for a "null". On a null or empty job title string, the code should output, "Bill Lumbergh, with Initech". Matt didn't particularly want to add that check to his code, since the data should be clean by the time he got it.

Matt chatted up Cecil, the developer who maintained the component that populated the session variables.

"Hey, could you do me a favor?" Matt asked. "If something comes through as the string 'null', could you make it blank?"

"Oh, yeah, no problem," Cecil said. "I'll roll that out later today."

A few hours later, Matt grabbed the latest build and re-ran his test, confirming that Cecil had done exactly what he asked.

Bill Lumbergh, blank for Initech.

proget-icon.png [Advertisement] ProGet supports your applications, Docker containers, and third-party packages, allowing you to enforce quality standards across all components. Download and see how! TheDailyWtf?d=yIl2AUoC8zA4Q1Pg8L_WLk
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments