Stage 3: Bargaining
Okay, so we've acknowledged that there is a bug in our application and we're done griping about it. Now what?
Look for the path of least resistance, of course! That database corruption problem? No problem. We'll "fix" it with some manual modifications to the database. That pesky null object reference error keeps popping up? Just wrap everything in a try/catch block! Programming is easy!
At this stage in the debugging process, we are usually presented with two options. We can either:
Fix the problem the right way, once and for all.
Throw together a hack and hope it works
Option #1 is obviously the right choice, but option #2 sure is much easier. After all, a hack is quicker to write and will probably hold up well enough for the time being. And even if it doesn't, what are the chances you'll be the one who has to deal with it?
To some extent that is all true. It's like putting off emptying the garbage can. You can get away with it for a while, but eventually someone's going to end up in a pile of filth.
Stage 4: Depression
Programmers love to whine. It's easy to feel sorry for ourselves. Our work is constantly scrutinized, analyzed, and criticized. Due to this, we end up spending a considerable part of our working hours fixing bugs instead of what we want to do: create video games (admit it, it's true).
Debugging isn't what any of us signed up for. Most of us love to create, but abhor having to maintain our creations. It is here that a lot of developers hit a brick wall. They are paralyzed by the dread of the inevitable work that will ensue. If you find yourself in this situation, it is important that you recognize it.
You are far better off taking a break and going for a walk than you are just sitting at your desk feeling sorry for yourself. At the very least, you will come back rejuvenated and (hopefully) ready to tackle the problem.
Stage 5: Acceptance
Finally, an end to this emotional gauntlet! We've acknowledged the existence of the bug, vented our frustrations, resisted the temptation to throw together a hack, and finished feeling sorry for ourselves. Makes you exhausted just reading about it...
Most people fail to realize that debugging is an emotional roller coaster for programmers. The constant ups and downs that come with the five stages of grief cause a great deal of strain on our psyches.
This is undoubtedly one of the major sources of stress in our occupation and could explain why so many of us burn out so quickly and so suddenly. It takes a certain type of person to be able to endure this day in and day out. And while your managers, friends, and family may never acknowledge your suffering, you have my deepest sympathy.
To those who are about to debug, I salute you.
Kevin Pang is an ASP.NET developer and an ALT.NET supporter. He blogs about software development.