4 ms·
Logging. You forgot to mention good logging practices. It is like predicting what information will be needed if you ever need to troubleshoot a piece of code.
by corpMaverick 8y ago
Logging. You forgot to mention good logging practices. It is like predicting what information will be needed if you ever need to troubleshoot a piece of code.
- josteink 8y ago> Logging. You forgot to mention good logging practices. Good logging practices help you pinpoint what code you need to debug. It does in no way replace debugging.
- drb91 8y ago> The most effective debugging tool is still careful thought, coupled with judiciously placed print statements. "Unix for Beginners" (1979)
- rsynnott 8y agoNote the date. There have been some changes in tools in the last 40 years.
- drb91 8y agoIt’s still true. A debugger is still unnecessary for daily debugging.
- rsynnott 8y agoUnnecessary, maybe, but it's nice to have. I use IntelliJ's most days. If I just had something along the lines of gdb, I'd use it a lot less frequently; convenience and features have absolutely made debuggers a lot more attractive over the last few decades.
- josteink 8y ago> A debugger is still unnecessary for daily debugging. I think this serves nice as a historical record of how the state of the art was 40 years ago. Today, we have IDEs with integrated debuggers (not to mention Emacs and other editors usually integrate decently with gdb, lldb, pdb, etc. Using a debugger doesn't have to mean leaving your code and starting a different tool and different flow. If you'd ask any of my colleagues what they'd do if there was a new policy saying use of debuggers were no longer permitted on a daily basis, the answer would more likely than not include the word "riot". In a huge, complex code-base created by a diverse team of varied skill and competences, you can't assume all code is good or self-explanatory. When you get confused about what happens where and why, the debugger is probably going to be your best friend.
- drb91 8y ago> If you'd ask any of my colleagues what they'd do if there was a new policy saying use of debuggers were no longer permitted on a daily basis, the answer would more likely than not include the word "riot". I’d imagine you’d have the same effect if you mandated the use of debuggers. And hey, I’m not arguing against their use, just saying they aren’t needed for most debugging. I would bet the vast majority of bugs in managed languages have bugs that are easily discernable if you have decent type/assertion boundaries. Needing to use a debugger is certainly a smell about your code.
- capdeck 8y agoI'd argue that print and log statements are just poor man's debugger. I don't deny the use and usefulness of logging in general, just it's use for debugging. In order to catch a bug you need to cast a very wide net of print statements. Debugger allows you to seamlessly travel up and down the stack frames, look at different variables on the spot and investigate different code execution paths, even the ones that you didn't not expect you would at the start of the session. Doing the same with log statements is amazingly inefficient.
- drb91 8y agoI’d call the debugger a nuclear powered print statement. Printing allows you to view particular state at a specific point in program flow; this is often all that is necessary to identify the bug. Doing the same thing with a debugger is amazingly inefficient. ...obviously this is mildly fascetious, but I want to point out the absurdity of assuming debugging is a difficult endeavor. That’s how it becomes a difficult endeavor.