Before the rush at Bespokeware
published: Wed, 9-Feb-2005 | updated: Thu, 27-Oct-2005
It was four o'clock in Bespokeware, our à-la-carte software and hardware shop, about an hour before the evening rush of tired-and-stuck programmers hit. It was always the same on a Thursday: they'd over promised at the beginning of the week and come Thursday afternoon realized that they only had one day left to complete their projects. And that meant more business for us as they came rushing in looking for help.
I settled back in the comfy chair, reading Martin Fowler's latest paper. Tom was fiddling around inside a customer's desktop. He was the consummate hardware geek; always changing this or that chip or board.
An expletive ripped through the air as a jagged soldered pin ripped through his knuckle.
"Now, now, Tom," I said. "It's a good job the customers aren't here yet: they're going to be stressed enough as it is."
"Sorry." He pushed the new board in, closed up the side of the machine, and powered it up. I sipped on my latte. Fowler was making a valid point, but in my relaxed state it seemed that I wasn't joining up the dots too quickly.
There was a loud rat-a-tat-tat on the shop door.
"A bit early. Tell him to get lost," muttered Tom darkly. Obviously the driver wasn't seeing the new board.
"Indeed, and of course not." I responded to both his points, went to the door and opened it. Outside it was a bright sunny day, shoppers with brand-name bags passing to and fro, happy smiles on their faces as they chatted. The man at the door though was anything but happy.
"Your piece of tripe data structure is crashing," was his opening gambit.
Through my mind flashed a vision of my perfect kick-boxing jab to his throat and his head snapping back, but instead I smiled at him.
"Why don't you come in and explain the problem."
He brushed past me and sat at one of the tables. Tom looked at him as if gauging the size of the stone from under which he'd crawled.
I remembered him now. He'd come in a couple of weeks ago and I'd helped him with an implementation of some data structure or other. A bad tipper, I recalled. I'd worked hard on the project, brought it in under budget and within a day, saved his bacon, and he'd stiffed me with the tip. When will people realize that if they want better service they'd better take care of the staff.
He had a laptop ready to show off the problem. I still had the smile on my face, although it was starting to hurt my cheek muscles. He showed me the problem: lo and behold his application was raising an unhandled null pointer exception bang in the middle of the data structure code. I mulled over how to approach this.
"Could I?" I asked, motioning to the laptop. He handed it over. I browsed through the source code. Some of it didn't look familiar to me. I brought up the test suite I'd provided as part of the job and ran it. A test case failed immediately.
"That's odd," I said. "The test suite was working when I handed over the code but now it's failing. Have you changed anything in the data structure code?"
"Just a minor enhancement," he replied brusquely.
"Did you run the test suite afterwards?"
"No, of course not. It was working in my application which is test enough. Besides I didn't have time to understand and mess around with all that test code."
The smile on my face was starting to feel like rigor mortis.
"I'd venture to say that perhaps the failing test case might have helped you find the problem. Look here," and I pointed at some code. "Your change means that this object gets freed before it should be. This means that under certain circumstances, the circumstances which the failing test case was checking, the run-time library will raise a null pointer exception."
He looked at the laptop's screen for a long moment and suddenly folded it up. "Good day," he said and was gone, the shop's door bell tinkling as the door slammed.
"Very diplomatic," Tom said. "I'd have told him in no uncertain terms that the test suite is there to be used and run regularly and only idiots don't do so. And that only complete brain-dead idiots change the code without changing the test suite."
I chided him but for some reason my smile wasn't hurting any more. Fowler, the comfy chair, and the latte were calling and I settled down again for those few minutes of peace before the rush. Outside the passers-by passed by with their Gap bags, the sun shone, and all was well with the world.