Ask HN: How do you get better at debugging/finding a solution?
71–80 of 83 posts
Re: Ask HN: How do you get better at debugging/finding a solution?
#72Something I read forever ago and can't find a link for: Keep 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…
Re: Ask HN: How do you get better at debugging/finding a solution?
#73Earlier quoted context omitted.
> 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.
Working for a bigger company I’m hesitant to go for a walk as that would mean I need to stay longer in the afternoon/evening. Even when going for a walk solves the problem, there is still little acceptance to count it as working hours. I think this mentality should shift somehow as it would benefit the company and the employee.
1) Find an employer who doesn't pay by the hour (but e.g. per day or task/goal)
2) Find an employer who isn't strict on the hours.
3) Self employment.
4) Find or convince an employer who accepts this.
None are ideal, except for #4, but its the long breath.
And I am thoroughly convinced it works. Same with workout, mindfulness. Such behavior should be rewarded. My employer supports workout in the sense I get 1 hour per week paid leave for working out.
Re: Ask HN: How do you get better at debugging/finding a solution?
#74Another approach is to use tools (system stats, logging, debuggers like rr/pernosco, etc).
Learn as much as you can about the system and tools you're using.
Reduce the size of the problem (reduce code, isolate, etc).
Read the code, and try to break it. Build scenarios 'this thing I see in the log can only happen if...'
Finally, there's no shame in rubber ducking a problem with a colleague!
Re: Ask HN: How do you get better at debugging/finding a solution?
#75Of course I've seen people who could pull out the same without having that much time. I respect and admire them.
Re: Ask HN: How do you get better at debugging/finding a solution?
#76Here's a trick you might find useful when you are really stuck and don't see any path forward: change some random related things in the code. If the code does not respond to those changes as you expected then that is a clue! There is something there you don't understand and the unexpected behavior is a clue to it. It's kind of like writing unit tests, checking for what you expect to be true.
Keeping a journal is essential also.
Re: Ask HN: How do you get better at debugging/finding a solution?
#77* start logging shit, even things you know to be true / can't possibly be the problem. Somewhere your model of the code is broken, and you need to test find the breakage (model needs correction, or program needs correction). * Split the problem space. Payment messages are not getting to the slack channel. Well, is it a bug in receiving payments, or a bug sending slack messages? Check if the payments are hitting the d…
I also can't agree more with no shame in asking others. I would go as far as to say if you aren't asking others, you are going down a dangerous path of assuming you can solve the world's problems by yourself.
Re: Ask HN: How do you get better at debugging/finding a solution?
#78- Create a call stack map and write it down - This will give you an overview of which classes, functions, methods, paths are being used. - People look down on console/logging, but it's useful specifically when there are race conditions or too many variables. It's way better to have several outputs and logs rather than a "standstill" picture you can only look while using the debugger. - "Learn to debug" - This advice…
It also works across every programming language and development stack. It can be setup across network and application boundaries. Debugging skills with logging is extremely portable.
Re: Ask HN: How do you get better at debugging/finding a solution?
#79Re: Ask HN: How do you get better at debugging/finding a solution?
#80I've mostly worked alone as a developer. No-one is going to fix it but me. Actually I think I enjoy problem solving more than the actual programming. Though frankly programming and problem solving are so closely related they are almost the same thing. I can solve most problems I come up against day to day. I guess I can't solve them all because I do ask questions on Stack Overflow sometimes. I'm not sure why, I guess…