4 ms·
> It can be painful pairing with someone who keeps adding print statements one at a time and repeating the 15 step process to get to them when they could have p
by lolinder 2y ago
> It can be painful pairing with someone who keeps adding print statements one at a time and repeating the 15 step process to get to them when they could have put in a breakpoint right out of the gate.
This does sound painful, but this is not what most people who advocate for print debugging are advocating for.
If I'm only going to add one print statement, that's obviously a place where a breakpoint would serve. When I do print debugging, it's precisely because I haven't narrowed down the problem that far yet—I may have ten theories, not one, so I need ten log statements to test all ten theories at the same time.
Print debugging is most useful when the incorrect behavior could be in one of many pieces of a complex system, and you can use it to rapidly narrow down which of those pieces is actually the culprit.