4 ms·
No, you don't need hindsight to figure this out. It should be easy to figure out in advance which of these strategies is likely to be more effective in solving
by greenyoda 13y ago
No, you don't need hindsight to figure this out. It should be easy to figure out in advance which of these strategies is likely to be more effective in solving a problem:
(1) Go into the debugger and trace how the system got to the bad state it was in.
(2) Randomly change stuff and see if it fixes the problem.
After doing (1), you understand exactly what your code is doing and why. After doing (2), you may not even understand what the problem really was, or why it got fixed, or whether it's really fixed or just doesn't happen any more in this particular situation.
I've seen people debug using strategy (2), and when they give up and ask for help, stopping, thinking a while and employing strategy (1) will usually find the problem.