The user’s incident report did not contain the most useful description of the problem. “The calculator always outputs zero,” it said. Fortunately for Aram, he had a little bit of an idea of the context, and he knew that the issue was in the Customer/Regulation Administration Processor.

That name was a collective label for a suite of web applications, web services, and client pieces built around managing business process data for dangerous-goods regulation. The original design had been a bit of a mish-mash, and for the past year or so, Aram had heard that the core developers were gradually migrating it to a more SOA implementation.

Aram tracked the problem down to one specific screen in one of the client applications. The last release was six months ago, so he didn’t think that the ongoing development was the underlying cause of the issue, so he started the process of debugging by understanding what it did.

It was a simple screen, with five text boxes. The user filled them in, pushed a button, and saw results populated in five other text-boxes. The actual calculation was performed via a web-service call, and sure enough, it was stuck returning 0s, regardless of the input. Aram investigated how the service did its thing. And that’s where it got weird.

The service used Microsoft’s OpenXML SDK to open a spreadsheet called “FiveBoxCalculation.xlsx” from a web server directory which held files uploaded by the users. It jammed the five values from the form into the first five rows in column “A”. It flipped a flag to say, “the formula cache is expired”, and then saved it to a temporary file.

Aram spent a long moment puzzling over that step. OpenXML was a great way to build Office documents, but one thing it definitely couldn’t do was calculate Excel formula results. How could it be generating output? He kept tracing through the code.

After the code saved the file, it opened the file again. This time it invoked the Excel.Application object, from the automation libraries which allowed software to create a new instance of Excel.exe and send commands to it. On the web server. The code used the Excel application to open the spreadsheet and then save it again, which would re-calculate the fomula results. Then it re-opened it with OpenXML, read out the results of the formulas from column “B”, and returned that result to the client.

Aram checked the server logs. The service was failing because it couldn’t find the Office automation libraries. Excel didn’t exist on the web server. Aram contacted the server admins to ask why it wasn’t there anymore.

“Why would it have been there ever?” they demanded, although with more colorful language and some graphic descriptions of what should happen to anyone who installed client software on their precious servers. “Client software doesn’t belong on web servers.”

Aram couldn’t disagree, but the code had worked only a few weeks prior, which meant Excel had been on the server. Where had it gone? It took a lot of phone calls and emails, but he eventually found out where: a license compliance scan found it, but had no record of a valid license, and forcibly uninstalled Excel. Aram got it all re-installed and added to the License Compliance system, but he had one question.

The developer responsible still worked for the company. Aram climbed the five flights of stairs up to his cubicle. “If I’m going to handle support requests for this, I need to know why it works this way.”

His fellow developer grimaced, then explained. “That code, ugly as it is, used to live entirely in the client application. You know the users- they love Excel. They wanted to control the calculations via Excel templates, but still invoke them from the application. Nobody liked doing it, but we gave them what they wanted.
”But then the Customer/Regulation Administration Processor was declared an ‘Enterprise Asset’ by the IT steering committee."

Aram nodded. He knew this, but he didn’t really understand what it meant.

“Every Enterprise Asset is required to use a SOA architecture so that we can re-use business logic and data across the entire organization. No business logic is allowed to reside on the client side. So crap rolled downhill, and we were forced to move CRAP code uphill.”

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