Photo Credit: 'Steve Parker' @ FlickrWhen Steven saw that there was an opening in the Plant & Enterprise Dashboard Activity New Technology group, he jumped at submitting his application and, much to his delight, was accepted. PEDANT was an elite group within the IT organization that was responsible for the system that ran the large plasma status screens spread throughout the plant and corporate offices. At a glance, one could see everything from the number of new orders entered for the day, the thoroughput of the shipping department, the current stock trading price, employee-related news, and even the five-day forecast.

In recent years, the system was updated to support RSS feeds so that, say, Hank in accounting could see everything from the internal pressure of Liquid Nitrogen Tank #4 to news that Barb in HR was getting married in June, all from the comfort of his desk. Being responsible to an application visible to everybody from the CEO to the night janitor granted the PEDANT folks a kind of celebrity status. As a result of this, and the fact that the system was so very much appreciated, project funding flowed in. While the rank-and-file was used to 1970's lime green chairs, the PEDANT developers were racing around in Aeron chairs between private, windowed offices. And best of all for them, every day was free-donuts-in-the-breakroom day.

After being given the corporate "rock star" welcome of a catered lunch buffet in the large conference room on the fourth floor, Steven was given his first simple assignment to get to get a taste of the system. The screens used by the HVAC maintenance personnel gave readouts of the two AC units that kept the server room nice and cool. His "pop fly" task was to add another status icon for the newly installed third AC unit. "It'll be a copy-and-paste job, you'll see; have fun with it," were the parting words of Steven's manager before being turned loose on his project. And why not? Just look at the existing functionality and replicate it for the new AC unit.

Of course, within two minutes of looking at the code, Steven realized that it wouldn't be anything like a clean copy-n-paste; after all, the code-burglar had already left his copy-n-paste stash in the app.

Code Burglar's Stash

When many naive developers first wander their way from the classroom into the working world, invariably they will produce some lousy code. Usually though, there is an advisor-type person who will review the code, point out "you're doing it wrong", and turn the failure into a learning experience. However, upon viewing the application source and associated tables, Steven got the feeling that that the application was created by a developer who was not given access to the latter. Also, when Steven saw that the comments in the source were for something called a "Base Ubiquitous Tank Temperature Measurement System", and that this clearly wasn't said system, he was going to be in for a wild ride.

The original developer had created a database structure which was painfully tightly-coupled to the UI. There were a couple of support tables in the mix, but for the remaining 90% or so, each screen that was shown to the user corresponded with a single table. Table names matched the screen's unique ID internal to each application, which wasn't so bad for matching screen to data source. But things got a little bit hairy when you had to know if FIELD32 was the value behind GEN-001... or was it FIELD23? Anything goes when columns are generically named FIELD00 through FIELD99.

But it wasn't all dark and gloomy. In a few rare cases, a developer seemed to add some brilliance and innovation by retrieving font size and color from the database. But any hope of changing the title were dashed when Steve learned that the same developer would hard code a value assignment shortly after retrieving the dynamic value.

' Update  labels
lblEquipmentText1.Text = d[0][1].ToString();
lblEquipmentText1a.Text = table.Rows[1][1].ToString();
lblEquipmentText2a.Text = table.Rows[2][1].ToString();
lblEquipmentText2b.Text = table.Rows[3][1].ToString();

... snip ...
lblEquipmentText1.Text = "A/C #1 Mod";
lblEquipmentText2b.Text = "A/C #1 Seq";

What to do? Steven knew that, as a young and intrepid developer, he was going to change things and for the better.

The Proposal

Steven arranged a meeting with the most senior developer and the director of the PEDANT group and made his case. He proposed revamping the applications to store all UI information dynamically, recreate the table layout to have meaningful column names, and if nothing else, take the time to review source code headings to make sure that it matched the source file's intended purpose.

The higher ups nodded, seemingly with approval, and then shrugged.

"You see, these systems have a history," the Senior dev began, "if you go and upset the natural balance of things, everything is liable to fall apart because the sum of all our knowledge and experience will be worth exactly zero. This is just how we write code here, Steven."

"Besides, we have an image to maintain as being experts of a very complicated system that drives the company," added the director, "and if we upset that boat, production will come to a halt and we'll all be eating breakfast out of a vending machine like everyone else, get it?"

With that, Steven sheepishly agreed and made his way back to his sunlit desk with its posh, modern chair to file away his proposal for some other day. As he sank down in the seat, it finally hit him. He did get it. As the status display system had grown in popularity over the years, the codebase also grew along with it. To keep up with demand, corners were cut and anti-patterns had become the norm. Anything to keep adding new screens. The treats, the perks, everything that set the PEDANT group above the rank and file was not a reward for hard work, but instead, it was meant to be their, and now his, incentive to come back to work every day to support a truly horrid system.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!