2001: The Legacy Code

Dr. Dobb's Journal May 1998


Funny, the connections the mind makes. I was sitting at my keyboard, thinking that the Year 2000 problem was shaping up into quite a little horror show, when I suddenly realized that my thoughts had drifted over to the cast of the TV show "News Radio." My eyes strayed to my science fiction shelves as my fingers began to move on the keys...

The Internet radio station's manager cleared his throat. When this failed to get the attention of the staff, he tapped on his coffee cup with a pen. That worked: The cup cracked, hot coffee flowed onto his lap, and the staff looked up.

"Thank you. Oww. I called this meeting because the station is in trouble. For the past two years, since mid-1999, our advertising accounting software has been printing erroneous bills."

The announcer opened his eyes. "Kindly do not utter the words 'erroneous' and 'bill' in the same sentence."

"Sorry, Bill. And please take your feet off my desk."

"No problem, Dave. It was getting soggy anyway."

"Please pay attention; This is a pretty serious situation. It's this darned Year 2000 problem, and it's impacting the bottom line."

"I love it when you talk like that," said the sultry brunette sitting on the arm of his chair.

"The problem is legacy code," he went on.

Legacy code! The very name of eldrich horror! The entire staff shivered as though they had all spilled iced tea in their laps. The station manager turned to the Cobol mechanic who sat slouching insouciantly in a chair by the door, his legs stretched out in front of him. "You're going to have to -- er, do something," the station manager told him.

The mechanic grinned, popping his gum and drawing a cigarette from the rolled-up sleeve of his t-shirt. "I'm sorry, Dave," he said. "I can't do that."

"Somehow I knew you'd say that, but occasionally you can get the machine to work by uttering the proper magical incantation."

The announcer broke in: "It's Moore's Law, Dave: 'Any sufficiently old technology is indistinguishable from magic.'"

"Well, we can't let this situation continue. I anticipated that we might have this problem. I hate to do this, but -- Matthew, tell them what you've been up to."

Matthew adjusted his glasses. "I have Forth been studying. I must the problem to solve the word of unbinding speak. We the Forth must use, Luke."

"It's Dave."

"I mean Dave. Oh, darn. Now I've forgotten the word of unbinding."

"I didn't think that would work, but there are other religions."

Over the next three weeks they tried various incantations. One Indian brought an automated prayer wheel that spelled out the nine billion names of god. Didn't work. And then the station manager did what he had dreaded, and called in Monsignor Purvis and his Exorcist 2000. It got pretty ugly then.

Lightning flashed in the station manager's office and he spun around in his chair three times, spilling his coffee in his lap. The laserwriter in the outer office began spewing gross-looking green- and white-striped paper, and you wouldn't believe the language that came out of that thing.

It was Java.

Two weeks later, the station manager strode out into the outer office and tapped the receptionist's coffee cup for attention. "Well, the exorcism has worked. And it really did everything: It resolved all the Year 2000 problems, ported the code to the new server, translated two million lines of Cobol into nine billion lines of 100 percent pure Java, and morphed the whole schmear into a six-tiered intranet/extranet, replacing advertisers' snailmail addresses with e-mail addresses, not just in the database but even on their stationery and business cards. Now if we could just get it to reflect our new ad rates..."

The laserprinter spit a piece of paper on the floor. The announcer picked it up and read it in his stentorian tones. "It says, 'I'm sorry, Dave; I can't do that.'"

"Well that's just great," the station manager said, flopping down on the corner of the receptionist's desk and spilling her coffee in his lap.

"We're back where we started."

"Let me give it a try," the sultry brunette said, walking around behind the rack-mounted accounting computer. After a moment, the machine began to make moaning noises and suddenly paper began to fly out of the laser printer.

"These rates are correct," the station manager said as the brunette came out from behind the machine blowing on her fingernails. "What did you do?"

"I haven't the slightest idea," she answered enigmatically.

"Which proves my point," said the announcer. "It's incomprehensible precisely because we need it. It's Murphy's Law, Dave: 'Any sufficiently crucial technology is indistinguishable from magic.'"

--Michael Swaine


Copyright © 1998, Dr. Dobb's Journal