Chris's Wiki :: blog/programming/PrintfToSeeDynamicBehavior Commentshttps://utcc.utoronto.ca/~cks/space/blog/programming/PrintfToSeeDynamicBehavior?atomcommentsDWiki2017-09-25T10:01:03ZRecent comments in Chris's Wiki :: blog/programming/PrintfToSeeDynamicBehavior.By dozzie on /blog/programming/PrintfToSeeDynamicBehaviortag:CSpace:blog/programming/PrintfToSeeDynamicBehavior:87fe9b437ec6ccf01a917c7b007780037d50f22cdozzie<div class="wikitext"><blockquote><p>I could do the same thing with a debugger, but generally I find printf-based debugging easier and often I'd have to figure out how to hook up a debugger to the program and then make everything work right.</p>
</blockquote>
<p>Not to mention that in some languages, runtimes, or applications you don't
have a stepping debugger or cannot use stepping debugger meaningfully (because
protocol timeouts, multithreading, system being split into multiple separate
processes or even hosts, or some similar obstacle). On the other hand,
producing some sort of logs works almost everywhere and it works in the same
way.</p>
<p>In Erlang you don't use <em>stepping</em> debugger, you use <em>tracing</em> debugger,
something similar to <code>strace</code>, <code>ltrace</code>, or <code>tcpdump</code>. <code>printf()</code> is just like
that, except you can't set trace points dynamically on a running system.</p>
<p>As for me, I prefer to learn well one tool that works everywhere than to learn
half-heartedly dozen tools that can only be used in some specific
circumstances. (And this is why I use Vim even for languages that have
dedicated IDEs.)</p>
</div>2017-09-25T10:01:03Z