Search This Blog

Loading...

Friday, February 29, 2008

Writing Maintainable Code Considered Harmful (2)

Super Frank and Average Joe were good friends. Both of them grew up together in a poor neighborhood; both of them went to the same universities, stayed in the same apartment throughout the years of study and graduated together. Being poor boys they were, they were determined to make lives better for themselves and their family. So they picked computer science as their majors ( for monetary reasons, obviously). After graduation they both worked at an IT company as contractors.

As similar as their backgrounds were, Super Frank and Average Joe were very different in their programming talent and their programming interest. Super Frank was a hacker with an impressive resume; he contributed to many famous Open Source Software (OSS) while he was still studying. Average Joe, on the other hand, spent his time in college drinking and womanizing. His programming experience was limited to his coursework and nothing more. Super Frank knew a lot of programming languages, their respective idiosyncrasies, software methodologies, design patterns and even some testing methodologies, thanks to his extensive experience in working with OSS. Average Joe, meanwhile, knew enough about programming to get him graduated and landed on the same position at the same company as Frank.

At the first day of work, both of them were given different projects to work on. The difficulties of the projects were equivalent, and both projects were one man project. The manager told them if they did well, they could earn a permanent place at that organization.

Being a permanent staff at that place a big carrot for both Frank and Joe. Besides hefty paychecks, there were stock options, medical packages, free insurance for those lucky enough to become permanent staffs. Job security meant a lot of both of them, and they vowed to perform while they were contractors.

And so both of them started to work. The experience in OSS development helped Frank alot. Frank moved along the pace gracefully, applying everything he knew. His project was moving along very well, so well that he finished it in the half of the time planned. The manager estimated that it would take Frank 1 year to finish his project, but Frank managed to roll out the application in 4 months time. When the application went live, the users were mesmerized, they loved it absolutely. They had new feature requests. So Frank took another 2 months to tidy up the loose ends and fix bugs.

When 6 months period passed, the manager reviewed Frank's code, it was so...hmm, perfect. There was absolutely no code smells, and the code read like poetry. Usually when the manager did code review, there were a lot of WTFs. But in Frank's case, there was only sounds of adulation: ooh, great! Brilliant! Why I didn't think of it!

The manager was so impressed that he gave Frank another 1 year project to work on. Believing that his future would be fully secured if he could take the project and finish it in 6 months, Frank gladly accepted the challenge and worked frantically. And true enough, his diligence and brilliance paid off after he managed to wrap everything in 6 months time. Another miracle!

However, Average Joe wasn't doing so well. He was lacking behind his schedule, and he had a hard time doing coding. Now, don't get me wrong, Joe was OK. He knew his stuff, he knew how to do his job. He coded well, it was just that there were too many bugs, recurring bugs, the bugs that you won't expect them to appear because they were supposed to be fixed. When Frank started his second project, Joe was only 1/4 into his, at most. The application was very buggy, and the code was definitely unreadable. As the year-end deadline approaching Joe burnt midnight oil. He was very hardworking. He did everything in his capacity to make his project a success. But there were always hideous bugs lying out there to foil his plan. Hard as he tried, Joe couldn't finish his project in the specified time. His application couldn't go live and this failure hurt the bottom line of the company.

Finally, the D- day came. On that day, both of them would know whether the company offered them permanent positions. Frank was very confident of his tenure. Of course, after such a stellar performance, he had every right to feel optimistic. Joe, on the other hand, didn't feel so good. He was such a miserable failure when compared to Frank, that he wondered why on earth he applied to the same position as Frank in the first place. Frank's success simply compounded his fiasco.

The manager called Joe into his office, and Frank was waiting outside. After what seemed like eternity, Joe came out of his office, with a delighted face. Not a single word was exchanged between Frank and Joe, but Frank knew that Joe got a permanent position.

The manager then called out Frank's name, and Frank walked into the office with pride and with full confidence. The manager was very polite. He offered Frank a cup of coffee, thanking him for the great jobs he had done for the company. Frank was, he said, one of the best programmers he had ever seen.

"But, we regret that we can't offer you a full time position."

"What?!" Frank couldn't believe it, " Why?"

"Sorry for that, " the manager replied, " I know you have a good programmer, you shouldn't have problems finding jobs elsewhere."

Frank protested, " but I was doing very well in my job! What about Joe? You did offer him a full time position, didn't you? He was smiling when he came out of the office."

The manager rolled his eyes, speaking in clear tone, "Yes, we did offer Joe a position. Due to financial difficulties, we regret that we can only offer a position, and that went to Joe. Really sorry."

Frank stared in disbelief. Here he was, a programmer better than Joe, and yet the company dropped him in favor of Joe, an average coder?

Seeing Frank's puzzled look, The manager explained, "you see, you have finished your projects. Since you did such a fine job, there is no need to maintain those projects anymore. Even if we do need to maintain them, we can always get others to do the job because your code was finely written. So we have no use of you."

"But Joe, " he continued, "was lagging in his schedule, we need him to finish his project. No one can take over his project, and no one can help him. He's more useful to us at this stage than you. I am sorry, but this is life."

Yes, this is life.

Want to know the ending? The ending is Frank finally joined XYZ in sweeping streets for a living.


No comments: