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 16

How to begin a project with just an idea

Hi, I have an idea of an application, I'm excited about it, I'm a junior, I'm g...

READ POST
Follow @mshwf to see more of their posts in your feed.
dev.to is now open source!
View Announcement Post View GitHub Repo
George Marr
By day I write Python and other beautiful languages. By night I do the same thing but with more caffeine
Trending on dev.to
Tell me a good IT joke
#discuss #jokes #fun
How to Get Un-Stuck
#debugging #beginners #juniordev #career
Dev.To Discord Channel?
#discuss
Using Custom Types in JavaScript Docs
#discuss #vscode #javascript #documentation
#discuss What language do you think in?
#discuss #languages #programming
Explain Hashing + salting Like I'm Five
#explainlikeimfive #webdev
I used money as a β€œvalue” metric
#career
Tips for a successful switch to a standing desk
#career #health #life #tips