Welcome to MSDN Blogs Sign in | Join | Help
Risky Business

You've either experienced this first hand or heard about someone that has. You have a group project due next week and things are going great. By the assignment due date you have everything but a few small bugs worked out. You're looking at a 95%. But one team member just can't let those last little bugs go. The night before he stays up and tweaks the code (or if he's more desperate rearchitects vast portions). The bugs look fixed and he doesn't tell anybody that way it's a "surprise" when you get a 100% instead of a 95%.

You get the project back and low and behold you have a 62%. There's a collective *GASP*. How could this have happened!? Thanks to your teammate's last minute changes, the bugs were fixed but a core scenario ended up being broken.

Was it wrong for him to try and increase the quality of the project by fixing the minor bugs? The answer is to think of the change in terms of risk. As you get closer and closer to shipping a product, the risk for making a change goes up and up. Even a small tweak can cause a program to misbehave and in ways you never anticipated. This is why software needs testing: to try and find new ways of using the product that the developer didn't think of. So while your change is only one line and looks innocuous enough, you could have just broken your application's ability to save.

In class work, the risk comes down to is a 100% better enough than a 95% to risk getting a 62%? If not, don't risk changing the code because it's just not worth the risk.

It's the same in business: does the issue impact the customer enough that we need to risk making a change to accommodate for it? There is no simple answer here, but the day before shipping this question will get an enormous amount of weight. If there's an issue that needs fixing and you change the code wrong, you could end up shipping a product that's dead on arrival. This means recall and loss of profits (a possible company dooming experience if bad enough). Worse is that you only have a short amount of time to test it. Most bugs can take months to be found, others won't be found until the customer starts using the product extensively. You have to know that whatever change you make could very well throw all the work you've done over the last years away.

Risk will be defined differently across companies so there's no straightforward advice to give on how to evaluate the risk of a change. One piece of advice I can give is to listen to senior developers who have been with the company longer than you. They've seen more and will have a larger picture of the product as a whole than you do as a new dev. Be prepared to have someone reject a code change you make, even though it's just a trivial, easy code change and you really want to get it fixed and you don't understand how in the world the original dev didn't do it this way the first time. Whenever I find myself going down this road it's a clear sign that I don't understand why the code was written the way it was. It may have taken months of testing and weeks of investigation to find this obscure but troublesome bug that made the code the way it is and changing it back will put the bug back in again. Here's a good time to look at source history and see who wrote the original piece of code and why, then you'll have a larger understanding of the code and be better prepared to make an informed decision about the risk of changing it.

There's a great post on Chris Pratley's blog about how relinking Office 97 exposed an obscure bug in the Pentium chip which caused the application to crash, a good example of how no change is truly safe. You can read it here.

Posted: Thursday, December 21, 2006 10:15 PM by Chris Becker
Filed under: ,

Comments

Mike Fried's Blog said:

A collection of some good posts by other Microsoft bloggers to tell a tale about quality in software development.

# December 28, 2006 5:01 PM

CoolBeans: From College to Industry said:

Who has ever met that guy that insisted on writing every piece of code to be as fast as possible? We'll

# January 8, 2007 5:03 PM

Mike Lutz said:

Chris:

You wrote:

Be prepared to have someone reject a code change you make, even though it's just a trivial, easy code change and you really want to get it fixed and you don't understand how in the world the original dev didn't do it this way the first time. Whenever I find myself going down this road it's a clear sign that I don't understand why the code was written the way it was.

This, of course, is one of the things that makes software development so exciting:

1. The original developer may have been an idiot (this always has probability greater than zero).

2. The original developer may have been addressing an issue that is no longer relevant (e.g., packing data tightly in bytes because memory is scarce).

3. The original developer may have possessed a subtle insight that has escaped you.

All of these are addressed, to some extent, but including a rationale as part of the class / component / subsystem / system documentation. Even idiots have reasons for doing the abominable work they do! Whatever the case, it would be nice to have the rationale out in the open so you have better information on which to assess the risk of change.

Pedantically yours,

Mike

# January 22, 2007 1:01 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker