Sunday, June 25, 2006

Programmer's Error, Part I

Greg stared at the computer screen before him. He sat, leaning back in his padded leather office chair with an elbow resting on the arm rest and his chin on his hand. He didn't like to jump right into work when he first came into the office; it was always better to take five to start the day.

A steaming cup of green tea sat on the desk, a slightly fragrent sent wafting to Greg's nose. He picked up the cup and held it, taking in the smell, before sipping the tea. On the computer screen a browser window was open in the background, showing the edges of some content off of Microsoft's site. In the forground a window showed a blinking cursor at the end of the black text of computer code. Greg wondered what problem the program would confront him with today.

"Hey Greg, awake yet this morning?"
"Getting there. How about yourself, Sammy?"

Greg knew Sammy would be around. Sammy always did his morning rounds to make sure all his employees were in to work on time. Greg knew he liked to run a tight ship.

"I've got my drug of choice" Sammy replied, lifting his cup of coffee higher into the air. "How's the code coming along?"
"It's going without any major hitches so far. I should have something working by the end of the day, so by tomorrow I'll have something functional to show you."
"Great, I look forward to seeing it. Have a good day then."
"You too."

Sammy strolled off to check on the next crew employee. Greg figured it was time to dig into the code so setting his cup down he focused on the computer screen.

Yesterday I was working on finishing up this bit of functionallity. Shouldn't take too long to insert a bit more code and then give it a test run, Greg throught to himself.

Greg's fingers hummed along the keys on the keyboard and a foreign language began to appear on the screen. Greg always felt pride that he understood a language most of the general population didn't. Granted, it was a language that only computers understood, but with the number of computers grown exponentially every day, Greg figured that made him a some what powerful person.

After several minutes adding new lines of code to the program, Greg sat back and surveyed his work. "Finished," he said to no one in particular. For the past several days Greg had been ahead of schedule on his work and he was looking forward to leaving the office early today. He hadn't told Sammy that he was ahead because hie didn't want to be handed something else to do.

Greg reached for his mouse and clicked the compile button and then waited to see if the computer liked the code he had written. After several seconds the computer returned its response.

Line 523
; expected


Greg referred to line 523 and found the spot he had forgotten to place the semicolon. One press of the keyboard and the semicolon was in its place. Greg clicked the compile button and after several seconds teh computer again returned its response.

7 errors

Greg's eyes widened in mild surprize. Should have seen it coming he figured. Fixing an error like a mising semicolon usually lead to the computer then finding every other error you had made. After several minutes spent going through the code, Greg was again ready to compile it.

Build Successful

At least it all worked this time, Greg thought. He had fogrotten about his tea while coding, but remember it now he took a sip. It was cold. Oh well, he could get another cup once he finished this section of code. All he needed to do was make sure it ran right.

Finding the icon represent the finished code, Greg double clicked it. A black box appeared on the screen showing the code was running. Awesome, thought Greg, now I can get that tea while this runs.

Segmentation Fault

The white words glowed on the black backgroud. The program stopped running and Greg stopped with his knees bent, halfway out of his chair. This was unexpected. Greg sat back down and closed the program before running it again. Same results.

Referring back to the code, Greg began to mentally trace through it, following it as the computer would follow it. Something was causing the error, but what?

The minute hand on the clock ticket away. Greg ran his hand through his hair, unable to figure out what was wrong. Nothing seemed out of place, the code should work beautifully.

"Hey Dan," Greg called across the cubical wall. A voice floated back over the wall.
"What's up?"
"I've got a piece of code that isn't working and I can't figure out what is wrong. Would you take a look at it?"
"Sure, just email it to me and I'll see if I can find what's wrong."
"Thanks."
"No problem."

Greg finally got his cup of tea while Dan looked at the code. When Greg made it back from the breakroom Dan had news for him. "I looked at your code and it looks good to me. I even tried running it and it runs fine on my system."
"Really? I'll try it again on my system then."

Segmentation Fault

"It still gives me a segmentation fault. Can I see it on your system?"
"Yeah, sure, come take a look." Greg walked around the cubical wall and found Dan sitting in front of his computer screen with Greg's code visible on the monitor. Greg took up a position looking over Dan's should and when Dan ran the code it ran flawlessly.
"I'll be damned, it must be something with my system."
"That's all I can figure," Dan replied, swiveling in his chair to face Greg. Greg reached over and clicked the button to run the code again, just to make sure it was working.

Segmentaiton Fault

0 Comments:

Post a Comment

<< Home