When the big merger was announced, the IT staff of both corporations was a little bit nervous, and with good reason: The day after the announcement, many redundant positions were eliminated. Miraculously, the IT staff on both sides was left almost untouched. With the integration of two disparate code bases, there was a lot of work ahead.

The Odd Couple

During this process, Doyle discovered that his development group inherited a widely used enterprise-level suite of Visual Basic 6 client-based apps from "the other side." Doyle and his team were used to working in VB.NET, C# and ASP.NET; they felt a little taken aback at this news. But no matter, they thought -- it was only Visual Basic.

So, after procuring enough copies of Visual Studio 6.0 from various online auctions for the entire office, and applying 10-plus years worth of updates, they were ready to get their integration show on the road. They were just in time, because enhancements were rolling in by the truckload.

Doyle needed to add another country-code checkbox for Mexico to a user configuration screen. It turned out that the program got data about what company information a user could view by reading in a registry entry (a three-bit field):

If iChkBx And 100 Then chkUS.Value = 1 Else chkUS.Value = 0
   If iChkBx And 10 Then chkCanada.Value = 1 Else chkCanada.Value = 0
   If iChkBx And 1 Then chkOther.Value = 1 Else chkOther.Value = 0
 
   'If not visible then uncheck in case it got checked above.
   
   If chkUS.Visible = False Then chkUS.Value = 0
   If chkCanada.Visible = False Then chkCanada.Value = 0
   If chkOther.Visible = False Then chkOther.Value = 0

After some inspection, it was found that many UI input controls were controlled by this "bits in the registry" method.

To the developers who maintained the application before the merger, this was how they did things; but to those in Doyle's department, this method -- though functional -- made them cringe. They knew they could do it better. After all, with all the enhancements coming, they would be allowed to make improvements along the way, right?

Wrong.

"Hold on!" declared the project leads. Enhancements, like adding a new checkbox, were completely valid. But changing existing base logic -- no matter how flawed -- added risk to a process that, up until a few weeks prior, never needed to take into account that "other" might not suffice as a category for users residing in Mexico.

Hooray for Status Quo

In the end, the original caretakers of the app didn't feel too bad about this decision. They could go ahead and keep up the programming habits that they'd honed during the past decade. Now, Doyle and his team spend their time adding and swapping bits in the registry, learning the "other" way of doing things, and biding their time until the merger train pulls out of the station.


The Logic Behind Modern Maintenance was originally published in the April 2011 edition of Visual Studio Magazine. VSM is the leading site for enterprise .NET developers, and offers a free magazine subscription for influential readers.

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