4 ms·
I think if you are just pushing through (brute force) to fix a bug "without thinking" then you will never figure it out. Also, "thinking before" as the article
by ardillamorris 14y ago
I think if you are just pushing through (brute force) to fix a bug "without thinking" then you will never figure it out. Also, "thinking before" as the article claims, without actually looking at the code or stack traces, that's just mental brute force.
Pretty much it's a combination of both: you look at the code, you think about what's happening and what could go wrong, you look at the code again, you think some more, you look at stacks, variables, output.. and then you think again and BOOM: you figure it out.
The best debugging tool is you. Use all you have.
- amouat 14y agoActually, I think it's a bit more subtle than that. By using stack traces and debuggers etc, I can come up with a working and correct solution. But, by thinking through the problem at a deeper level I can come up with an improved design which may simplify future programming and avoid similar bugs.
- guelo 14y agoBut one must also be careful not to fall into the trap of premature optimizations and building unnecessary complexity.
- simonh 14y agoYou've just hit a real actual problem in the code. Factoring that out isn't premature, it's responding to reality.
- guelo 14y agoI was reacting to the idea that instead of fixing the immediate bug you just found you're going to redesign the whole thing to prevent that type of bug from occurring ever again in the future.
- amouat 14y agoAnd simonh was pointing out that it's not really premature if it's already occurred :) Don't get me wrong, you have a point - there is certainly a balance to be struck.