One of the advantages of being a contractor -- well, aside from getting paid nearly twice as much -- and aside from not having to work unpaid overtime -- is that being "on call" is generally not part of the job description. The whole 2AM-Oh-Crap-A-Batch-Job-Failed call followed by a six-hour I-Have-No-Idea-How-To-Fix-This-Crap debug session that's chased down with the Oh-Crap-It's-8Am-And-Time-To-Go-To-Work realization -- that pleasure is reserved for full-time employees. That's what Ivan D. believed, right up until he got a 2AM call of his own: we desperately need your help to find a screw in the warehouse; none of the full-timers are responding!

In his half-awake state, Ivan had no idea what they were talking about. Did they want him to come in like Sherlock Holmes and use his oversized magnifying glass to solve the Mystery of the Missing Screw? Sure, he had his drop-step pipe ready, but how was he supposed to get his overcoat and deerstalker hat from the cleaners at such an hour? And then it hit him: the warehouse application probably crashed and they needed him to run a few database queries to find out where the screw was stocked.

In many warehouses, a delayed order would not be reason enough to wake up a developer, especially a contract developer. However, this particular warehouse stocked millions of airplane parts that were urgently requested by inbound and outbound flights. They called Ivan up because a gate-full of passengers were anxiously waiting for their already-delayed intercontinental flight to depart. A single screw was all that was needed to finish the routine maintenance and send everyone on their way.

It was no surprise to Ivan that the warehouse application wasn't working. The system consisted of a COBOL "core" with a VB-based "screen-scraping" application on top. There was also a SQL Server database used for "convenience sake" and RF transmitters and scanners that the VB application communicated with. This architecture wasn't what made the system prone to failure -- it was more the developers behind it.

Several years ago, the airline's CTO set out to redesign the existing, COBOL-based warehouse system. He searched high and low to find the most qualified people to develop the new system and, in a remarkable coincidence, that just happened to be his nephew and his other nephew. Granted, neither had written a single line of code in the language they proposed to develop the system in, but they figured that since there's myriad books written about Visual Basic and they can both read pretty well, they should have no problem developing a mission-critical warehousing system.

It took them a few years, but the two actually managed to design and build the warehousing system. Granted, it was riddled with bugs, but that's what contractors are made for.

Ivan arrived at the warehouse a little after 2:30AM and was greeted by a frantic foreman who immediately showed him the error message. It was fairly straight-forward: the database query from the RF scanner was timing out. Ivan took a peek at the change logs and saw that one of the nephews deployed a new version of communication module shortly before he left for the day. Whoops.

Ivan opened up the VB project and found the code that was causing the problem. It looked something like this:

Set rsStock = objConn.Execute("SELECT * FROM [Inventory]")
While Not rsStock.EOF
  If rsStock("ItemId") = intItemId Then
    Call SendItemToTransmitter(rsStock)
  End If
  rsStock.MoveNext
Wend

It turns out that bringing millions of rows down from the database into a VB application just to look for a single row is a bit slow. Fortunately, it was an easy fix, so Ivan simply added a WHERE clause to the query, compiled the code, and deployed it. Within minutes, the warehouse worker was able to use his RF scanner to locate the screw and send it to the plane. Everyone -- from the foreman to the network administrator -- was astonished that Ivan was able to fix the bug so quickly.

"It's elementary, my dear coworkers," Ivan said as he headed back home.

Later that morning, Ivan arrived back at work feeling happy and refreshed. A few people thanked him again and his manager (the other nephew) asked to speak with him immediately. Ivan figured it'd be an official thank-you-for-saving-the-day thing. Not quite: the boss went off on him, criticizing him for coming in at an unauthorized time, making an unauthorized software change, and for compromising the integrity of the warehouse system. Ah well, so is the life of a contractor