DEV Community


How do you help yourself fix bugs?

George Marr
My curiosity is easily stimulated
・1 min read

Bugs, bugs, bugs...and more bugs. Probably one of the most annoying parts of development in general is having a bug that is causing a lot if not the entire thing to malfunction. Sometimes its the simple things, like a missing comma or semicolon. Others its the more major things where you just have no idea why it's broken.

How do you help yourself fix them?

Personally I like to step away from my machine and desk, either grab something to drink, eat, and the occasional scream outside in my back garden. As well as taking long (very long) stress walks to help clear my mind, I often find that half way through a track I'll come up with the solution in my head.

So, what do you do?

Discussion (7)

aleron75 profile image
Alessandro Ronchi • Edited

We have a rule (that requires working in a team or having at least a programmer buddy): spend no more than 1hr on a bug.
During this hour you can search on the internet, try to apply suggested solutions, try to find one by yourself.
At the end of the hour, if you are stuck, ask for help.
This rule came out from true stories of people (including me) spending hours or even days on bugs that only took some minutes to someone else to solve.
Sometimes it's all about understanding that we are too biased and need a new point of view.

rapidnerd profile image
George Marr Author

Would love to be able to have someone there that could help me, one of the minors of working from home.

ben profile image
Ben Halpern

I think this can work, but requires full buy in and everybody being on the same long as your working at the same time. Asynchronous communication is another story.

ben profile image
Ben Halpern

If the bug, or fickle feature, is really bad I know that time away will help. But it might not even mean that I have to step away immediately. I can keep at it a bit, kind of leave myself clues for tomorrow me who gets to see it with fresh eyes.

If I don't have the luxury of time I take a quick walk and then zone in to full-on reading mode. I just read like crazy on the web, hopefully finding new knowledge I was missing. Then I go back to trying to solve the problem.

In terms of more specific strategy, it's all about isolating variables. A lot of the time this means removing lines or finding ways to isolate the code, and then adding lines back in until the error pops back up.

raphael_jambalos profile image
Raphael Jambalos

I tell somebody about the bug. Laying out the options I have in mind.

Sometimes, if they are accommodating, they'd ask helpful questions that lead me to the solutions. Often, I figure it out myself just as I was explaining it to them (even before they get a chance to talk).

Sometimes you just need a sounding board.

quii profile image
Chris James

Bugs are quite a broad range of things. For my example I'm going to describe how i tackle some kind of behaviour failure than a user has described.

  • Figure out exactly how to reproduce it. Often this is enough to understand the problem.
  • Write a failing test that exercises the above. This lets you retry fixes very easily rather than manually going through the process. Plus it means the bug can never happen again once it's fixed.
  • Fix it by making the test pass
  • Reflect on what was missing in your monitoring and tests for this to happen. Can you take steps to avoid it?
rapidnerd profile image
George Marr Author

Excellent steps