5 stages of debugging

| 5 min. (857 words)

1. Denial

a) “It works on my computer – you must be doing something wrong” – this is the classic attempt at trying to remove the blame from yourself and put it onto someone or something else, be that a co-worker working on the same branch or the internet that must have dropped its connection right when your code tried to access it. It’s a basic survival reaction that serves to preserve our sense of self and self-belief. As long as you don’t overreact or draw out this process it’s perfectly fine to go through.

b) “Oh look, another project I forgot that I needed to work on” – otherwise referred to as productive procrastination. As tempting as it is to work on another project that you are almost guaranteed to succeed at, you run the risk of either having this distraction project break as well (in which case you have two broken projects)  or the previous broken project goes stale, you loose the mindset you were in at the time of coding and all of the code you wrote becomes dormant and that much harder to sink back into and consequently fix.

c) “Oh look…cat!” – this is just unproductive procrastination that is far too easy to fall into on the internet. While some may not think of this as direct denial, and they would be right, indirect denial can be just as bad if not worse, because you may not be consciously aware that you’re in denial – in your brain you’re just taking a 5 hour break to look at cats that leap in time to dubstep.

d) “Time to pursue my life long dream of being a woodland ranger” – this is just **full on avoidance **and should probably be stopped in it’s [hiking] tracks.

2. Anger

Ever had that feeling of utter rage that you just want to flip the desk and walk out? This massive urge to hulk out is not uncommon among developers – especially when it comes to debugging.

You’re too angry to be sad that your project isn’t working and what’s worse is that you probably have no one but yourself to blame. Whether it was past you being a lazy hacker or present you just not having the knowledge base to know how to approach the situation – experience being what you get after you most needed it and all…

Personally, I recommend letting the anger release in some shape or form – ideally not by raging at your work mates but perhaps a lunchtime martial arts class? After which your body may be so shaky that you literally have no energy to be angry anymore.

3. Bargaining

Here, you begin to reason with yourself – maybe you decide that no one will encounter the bug when you push it live and that’s the end of that – only future you has to deal with those repercussions by which time of course you’ll have the knowledge to deal with it (bad juju).

We’ve all had those conversations with ourselves of “just how necessary is [x] feature?” or “how much of my code can I strip back so that the error is gone but the functionality is still there?”

I must confess I don’t have any recommendations as to how to deal with this stage – just recognise that it is a phase and make sure you have a backup of the current project just in case you do start acting on these irrational bargaining conversations.

4. Depression

At this point, you start second-guessing every aspect that can be second guessed. Why didn’t you foresee this being an issue when you were originally coding? Why did you even start on this project? Why didn’t you wear your world-conquering Batman tee that could have prevented this whole fiasco from being so deflating?

This also isn’t helped by the waterfall nature of debugging, where what seems to be one error (big or small) is actually caused by a sequence of other hidden errors that constantly deflate your debugging efforts.

You’re also dealing with the emotional drain of your creative project not working how it does in your head. This is quite a blow – you don’t know if it’s a fault in your skill or what, you just know that something that you’ve been pouring all your efforts is just ungratefully flipping you off and that’s hard to handle.

Recommendation? And no I’m not proposing a cure to all depression, just debugging depression…Step away from the project and take a minute (or several) to change your mental state, maybe play some video games (if you’re desperate to stay computer bound) or play with some puppies.

5. Acceptance

After a long journey through all sorts of emotional turmoil, you come to the final stage.

It is only once you have reached this final stage that you can truly acknowledge that yes, this error is being a pain, and yes you will probably find a great deal more logic flaws or errors once you’ve fixed the current one.

But you know what? You are going to debug the hell out of it.