Ask HN: How do you get better at debugging/finding a solution?
21–30 of 83 posts
Re: Ask HN: How do you get better at debugging/finding a solution?
#22Keep a debugging journal. Take notes on every step you take and its results. It's easy to go in circles because you forget what you tried or forgot some detail of its outcome. Seeing a summary of what you already know helps you rule out possibilities and inspires new ones.
I often forget to do this or feel like "I can handle this bug without a crutch". Yet every time I actually journal the process it's helpful.
Re: Ask HN: How do you get better at debugging/finding a solution?
#23* When did this start happening?
* What changed between when it was working when it stopped working?
* Have you asked person Y who worked on that change?
Re: Ask HN: How do you get better at debugging/finding a solution?
#24Re: Ask HN: How do you get better at debugging/finding a solution?
#25Re: Ask HN: How do you get better at debugging/finding a solution?
#26Re: Ask HN: How do you get better at debugging/finding a solution?
#27It's probably not so much your colleague that helps but the act of just talking through a problem, inanimate objects work too https://en.wikipedia.org/wiki/Rubber_duck_debugging What also helps is just shutting the computer off and going for a walk, generally the moment you step away you'll figure it out!
> What also helps is just shutting the computer off and going for a walk, generally the moment you step away you'll figure it out! Underrated. Diffused mode of brain.
Re: Ask HN: How do you get better at debugging/finding a solution?
#28Re: Ask HN: How do you get better at debugging/finding a solution?
#29Have a hypothesis and try to prove otherwise.
Start cordoning off parts of the codebase where the problem ISN'T.
Leave printf breadcrumbs to trace execution.
I find my less capable colleagues make the mistake of false assumptions, like some subroutine is executing or what state an object is in without proving it to themselves. That keeps your investigation from proceeding without luck on the larger problems.
Re: Ask HN: How do you get better at debugging/finding a solution?
#30This advice would be very obvious to many, but I'm constantly surprised by how many of my coworkers don't know how to do this and test code by pushing logging statements into a production environment.