How do you help yourself fix bugs?

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?

Did you find this post useful? Show some love!

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.

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

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

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.

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.

Ben Halpern DEV.TO FOUNDER

Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

Please consider creating an account on dev.to. It literally takes a few seconds and we'd appreciate the support so much. ❤️

Plus, no fake comments when you're signed in. 🙃

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?
Classic DEV Post from Apr 7

How do you deal with burnout and low motivation?

The past few months have been a no-code zone for me. I've literally gotten noth...

READ POST
Follow @rjpsyco009 to see more of their posts in your feed.
George Marr
Crazy developer | Focussing on Theoretical programming and quantum computing | Tea?
Trending on dev.to
What are the first differences you noticed in GitHub after Microsoft bought it? Post here yours!
#github #microsoft #discuss
Biggest aha moment
#discuss
Follow Friday!
#discuss
How to deal with being laid off?
#work #job #development #discuss
Ever feel like you have "Programming Synesthesia"?
#discuss #programming #productivity
When is code "too clever" / how do you think about readability/cognitive load?
#discuss
How do you get a decent estimate on the time it will take to complete a task?
#discuss #work
What's a recent frustrating bug you've had with a crazy simple solution?
#debugging #discuss #php