jack: (Default)
[personal profile] jack
I was hoping this was going to be a bit more technical, but there you go. The idea is to write inspired by whatever I'm doing at the moment.

This is not so much debugging as, when you're sure the problem is fairly simple but it still sucks you in for ages and you can't tell if you're getting it fixed, how to avoid being dispirited. Which is a problem I used to have a lot. What has helped?

1. Talking to other people! Partly for a second pair of eyes, partly to just ground yourself and get someone else to share the situation and agree you're doing the right thing.

2. Take regular breaks.

3. Work through the problem step-by-step. This should be appearing here. It isn't. Check each intermediate step.

4. Decide if (often), it's worth making the step-by-step tests ones that can be saved in the test suite against future failures, rather than ad hoc "step through in debugger".

5. If you can, maybe work on something else for a bit.

6. Be realistic if this is still the most important thing to do or if you should be doing something else.

7. Be realistic, do you know as much as anyone else about fixing this? If so, seek to keep your spirits up and bring in second pairs of eyes as necessary. If not, don't be shy, seek out advice on how to debug the problem.

8. Take heart. I've faced a LOT of problems that have seemed simple but intractable, and looking back with the benefit of hindsight a few were beyond me at the time, and many would have benefited from a fresh perspective, but none were actually black magic, there was always a sensible way to proceed, and I usually found one.

Date: 2018-04-17 04:00 pm (UTC)
angelofthenorth: Two puffins in love (Default)
From: [personal profile] angelofthenorth
That's really helpful. I'm learning to code in R, and SQL, and that's such useful advice. Thank you

Date: 2018-04-17 04:24 pm (UTC)
mtbc: photograph of me (Default)
From: [personal profile] mtbc
Today I had a wrong value ending up in a variable and in searching through relevant code, etc. couldn't at all find where this wrong value was getting set. (It's getting passed among many Java classes and over RPC.) In the end I plugged in the debugger and used it via stacktraces at breakpoints to work backward instead of forward and then I found the culprit. So, your (3) can work both ways!

Date: 2018-05-10 02:46 pm (UTC)
mtbc: photograph of me (Default)
From: [personal profile] mtbc
Not really what your point was but this is partly why frequent commits help: git bisect and its like.

Date: 2018-04-17 08:19 pm (UTC)
green_knight: (Default)
From: [personal profile] green_knight
I've found that isolating the problem often helps me - I write a new application with Just That One Thing and see whether it persists. And I try to write the solution from scratch, because very often having to think my way through it again helps me see where I went wrong last time.


Active Recent Entries