Tuesday, May 18, 2004

Paranoid, anal, whatever

Encyclopedia of Wireless TelecommunicationsI was talking with M today about a billing problem he encountered with his mobile phone. Seems there was a not-so-slight bug in their minute-tallying code. If you dialed a number, hung up, and then dialed again... both calls were charged. And the first call generally would get billed 30 or 40 minutes. Uhm, that's not right. Enough people complained that they not only retroactively repaired the bills... but they even fixed the billing software. Go figure.

As we discussed this problem, one of my most disastrous software screwups popped into my head. All of the intentional mental blocks I'd thrown up had failed. And even the fail-safes had failed. It was all coming back to me... all the pain, adrenaline shock, and pure horror. The reason why almost anyone who's ever reviewed my source code has said one thing.

"Damn, you are one anal SOB."

Ah, pull up a chair, youngster, and let me tell you a story of why I check every error condition, log every bizarre, impossible situation, and even alphabetize my class members and methods with perfect tab alignment throughout. Maybe that last part is going overboard a bit. Nonetheless...

I was still at my first job, at the O Corporation (see previous blog entry for more mundane, pointless detail). I'd been there a year or two, and was getting pretty good at all sorts of real-time, assembly level hacks. One of our products needed to be able to communicate over a dialup line. This predated the Internet. Hell, it predated modems. All we had available for data communications were Anderson-Jacobsen (click for picture) acoustic couplers.

Basically, the A-Js were the precursors of modern dialup modems. You could get a blistering 110 to 300 baud transfer rates out of 'em. We were like, "300 baud? NFW! That's awesome!".

One of our products had been deployed in Chilicothe, Ohio. Way too far to drive on a regular basis. So one guy rigged up the product to accept dialup calls using his A-J. His system would wait for a call, bundle up some data and send it back to the caller.

I wrote the management side. Created a serial "driver" to talk to the A-J (we didn't have no stinkin' COM ports then, biatch, we're talking raw UART control code). Then added a layer to harness the awesome power of the A-J through the equivalent of control strings (similar to Hayes AT codes). And lastly, added the scheduler and control logic that would dial up the remote system, request the data, and save it into a text database for my batch reporting tools.

Oh, this was going to be sweet. It was too damn cool. A couple of tests later, I was ready to rock. It looked like it was working perfectly. This was a Friday, so I scheduled a collection job and took off for the weekend.

Came in Monday. Wow, it had worked. We'd collected all the data. I was pumped! I hardly noticed that the modem was still connected. Hmmm. That's weird. Just a fluke. I'll just recycle it, no problem.

A week later, the receptionist called. "Do you realize one of your phone lines had a long-distance charge of $2,100 on it?".

"Well, I didn't do that. Sounds like a problem with the phone company."

I hung up and four gallons of adrenaline got pumped into my stomach as I realized that the modem had been on that entire weekend. The VP of Engineering was walking over. Oh s**t. This wasn't going to be good. He'd obviously heard the news.

"What the heck happened to your phone bill, Ross?"

"Uh, not sure, sir. I think... I think... my software neglected to hangup the A-J."

"Well, you're damn lucky." Huh? Why? "Because the receptionist sweet-talked the Bell customer service people and convinced them they had a problem with their billing. They reversed the charge." Wheeeeew. That was quite a relief.

So call me Paranoid. Anal. Whatever. That debacle forced me to be ultra-careful. All of those "that can't happen" conditions? I check 'em and log 'em. I don't want the equivalent of a four-figure phone bill on my watch.

Encyclopedia of Wireless Telecommunications

No comments: