3 ms·
Conditional break points are definitely a great secret weapon. But don't underestimate the value of the humble print statement. It's convenient and can often le
by elric 6y ago
Conditional break points are definitely a great secret weapon. But don't underestimate the value of the humble print statement. It's convenient and can often lead to surprising insights "hmm, why is this getting printed so damned much?" in a way that is sometimes more accessible than a debugger.
- blacktriangle 6y agoThis right here, print statement debugging gets far more of a bad name than it deserves. If that's a developers only tool then sure that's a problem, but no need to hate on a very simple and effective technique just because it's often the only one people know when they are starting out.
- zaphar 6y agoPrint debugging results in a printed log of this happened, then this happened, ..., and finally this happened. And you can trivially rewind it and do random looks at the log. Debuggers have difficulty giving you this much context at your fingertips. The downside is that if you missed one of those critical "this happened" items in your log you have to rerun. But debuggers have the same problem. If you missed a breakpoint you have to re-run.
- dropofwill 6y agoIntellij’s debugger has a ‘drop frame’ feature that i use a lot for going back in time when i missed something. It also shows you the state of variables at various points alongside the code, which is basically the context i want to log anyways.
- throwawaywindev 6y agoYou can make breakpoints that just print stuff (at least in Visual Studio)