Which in some cases I see as related to a sort of macho attitude in programming where people are oddly proud of forgoing using good tooling (or anything from the 21st century really).
Don’t look down on print debugging
11–20 of 164 posts
Re: Don’t look down on print debugging
#12However, if I know I'm going to be working on a project for a long time, I usually try to pay the upfront cost of setting up a debugger for common scenarios (ideally I try to make it as easy as hitting a button). When I run into debugging scenarios later, the cost/benefit analysis looks a lot better - set a breakpoint, hit the "debug" button, and boom, I can see all values in scope and step through code.
Re: Don’t look down on print debugging
#13To me there are three requirements for me to be comfortable with a team culture of print-debugging. 1. If a breakpoint debugger exists for the stack, it should still be convenient and configured, and the programmer should have some experience using it. It's a skill/capability that needs to be in reserve. 2. The project has automatic protections against leftover statements being inadvertently merged into a major branc…
Why would debugging be a team culture thing? It's very individual in practice.
Re: Don’t look down on print debugging
#14If you feel shame because of random opinions and articles on the internet, I’d address that before worrying about “print” vs. a real debugger. I pretty much only use print debugging. I know how to use a real debugger but adding print/console.log etc. keeps me from breaking context and flow.
Re: Don’t look down on print debugging
#15Re: Don’t look down on print debugging
#16Some of the trickiest bugs to hung down are those involving concurrency and non-deterministic timing. In these cases, stepping through a debugger is not at all what you want, since you may actually change the timing just by trying to observe. To see the nature of the race condition, just put some print statements in some strategic locations and then see the interleaving, out of order, duplicate invocations etc that a…
Still agree that print debugging is more useful in such situations (and I prefer it in general).
Re: Don’t look down on print debugging
#17If you feel shame because of random opinions and articles on the internet, I’d address that before worrying about “print” vs. a real debugger. I pretty much only use print debugging. I know how to use a real debugger but adding print/console.log etc. keeps me from breaking context and flow.
I only use print debugging when working on the web, and your mention of console.log makes me think maybe you're in the same boat. It's an absolutely damning indictment of the developer experience for the web that this is the case. Why aren't our IDEs and browsers beautifully integrated like every other development environment I use integrates the runtime and the IDE? Why hasn't some startup, somewhere, fixed this and…
0: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: Don’t look down on print debugging
#18Re: Don’t look down on print debugging
#19Some of the trickiest bugs to hung down are those involving concurrency and non-deterministic timing. In these cases, stepping through a debugger is not at all what you want, since you may actually change the timing just by trying to observe. To see the nature of the race condition, just put some print statements in some strategic locations and then see the interleaving, out of order, duplicate invocations etc that a…