A new job is like a child. At first, it appears completely harmless and full of wonder. It's only after you've invested grinding years of your life into it, surrendering sleep and any sense of fun, that you discover that it's a complete disappointment and will never amount to anything, never respect you, and it certainly isn't going to take care of you during your twilight years.

Chuck's first day at his new job was much like that. He whistled a cheerful little tune as he walked across the parking lot. There were no first-day nerves. He looked forward to the day. The company ran clinical drug trials, so he felt like he might be doing some good in the world. The co-workers he had met while interviewing seemed like good people. Plus, he'd get to brush up his .NET chops. It wasn't a dream job, but it looked like a pretty good place to work.

"Talk to Vince to plan your travel," his boss said late on the first day. "You'll need to get out to California ASAP."

"California?" Chuck asked.

"Hmm? Yeah, that's where the subsidiary you're going to be working with is located. They're a recent acquisition, and you'll need to bring their Portal application into our support organization. They don't actually have any developers in that branch." What his boss didn't add was that the company had fired all the developers after the acquisition.

That sounded… reasonable. He was annoyed that they just dropped that on him, but it was like an infant burping up on his new shirt; how annoyed could he really be with this cute new job? Like a good little scout, he packed his bags and trucked off to the subsidiary.

"You picked a good day to arrive," Freddy said when Chuck met him at the subsidiary's office. Freddy was supposedly 30, but he looked closer to 50. He was a twitchy, rat-like sort that looked like he'd bolt and hide if there were any sudden noises. "We're right in the middle of a production outage. A whole section of the app is blowing up on us, no idea why."

That didn't sound like a good day to Chuck, but he was game. He fired up Visual Studio and said, "Well, if you tell me where the code is, I can take a look while you walk me through what's wrong."

"Huh? What's that?" Freddy replied. "Nah, you need to open up Access."



This didn't sound good. Freddy pointed him to a network share and an Access DB. "This here is our Portal application. It covers everything- or the 'three-Ps' as we call it- patients, patents and payroll. I knocked this out in a few hours back in my CPA and it sorta just kept growing. I hear you're supposed to be the one to replace it, though. Probably be nice to have something developed by a professional, yeah?"

Chuck didn't stand up, charge the nearest window and leap throught it like he was fleeing a burning building. Instead, he did the completely insane thing and said, "Well, we had probably better fix the current production outage, right?"

"That's the spirit! The whole damn company's paralyzed till we do, so let's get to it." Freddy walked him through his standard debugging checklist. It wasn't all that standardized, and it was less a list and more, "here's my vague memory of how this has broken in the past". The possible ways it had broken in the past was utterly staggering. The first thing to check, always, was the file-size. Access had a limit of 2GB, and they had hit that limit all the time. Today, it hovered at 1.5GB, so that wasn't the issue. Freddy and Chuck wandered aimlessly through some VBA subroutines trying to find the underlying problem.

"Well," Freddy said at 11:30, "I'm going to knock-off for lunch. Let me know if you make any progress."

Chuck nodded absently. He stared deep into the abyss of terrible VBA code, and the abyss stared back into him. By 1:30, there was no sign of Freddy, but Chuck knew where the problem was, even if he didn't really know what it was. Deep inside a stack of nested for loops, he saw this:

ReDim Preserve arrUsedCtls(m+1)
arrUsedCtls(m+1) = arrCtlNames(k) & j
Dim ctl = frmForm.Controls.Add(arrCtlTypes(k), arrUsedCtls(m+1))
The actual failure occurred on the Controls.Add line, which didn't really make a lot of sense. The application was deep into a nested iteration. It had already added (and removed) hundreds of controls to the form. Without Freddy around to explain exactly why the form needed so many controls, he couldn't guess what this code was actually trying to do. Or why.

As Chuck stared blankly at the screen, he thought about that 2GB file limit. Was there some other limitation in Access he didn't know about? A little googling turned up a bizarre sounding candidate: a form could only instantiate 754 controls over its lifetime. He traced through the code and added up how many times that line would be called, assuming it didn't crash. It took some calculator wizardry, but after multiplying all of the nested loops together, he got 829 calls to Controls.Add.

Freddy didn't return that day, so Chuck fiddled with the form and the query behind it until he managed to cut down on how many times it ran through the loop. He wasn't certain that he hadn't broken any logic, but he figured Freddy could look at it tomorrow before moving it into production. As he thought that, Chuck realized that they probably didn't have a test environment, and that he had just mucked with production. And he wasn't entirely sure how to revert his changes…

Nobody complained. To the contrary, everyone seemed happy to have "the Portal" back online. At the end of the week, Chuck grabbed a copy on his thumb drive and scuttled back to the home office to lobby for throwing the damn thing out now and rewriting it. Or moving that subsidiary over to the same software the rest of the company used. Or maybe they could put it up for adoption or send it away to boarding school.

"Don't worry," his boss said, "we're going to do that just as soon as the budget clears…"

Chuck left that job three years later. When he went, he handed the very same thumb-drive to his successor. That thumb drive still circulates that company to this day. But don't worry- just as soon as they clear up some room in the budget, that Access DB is totally going away.

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