<story><title>Print Debugging Should Go Away</title><url>https://robert.ocallahan.org/2021/04/print-debugging-should-go-away.html</url></story><parent_chain><item><author>falsaberN1</author><text>You can pry my debug prints from my cold, dead hands.&lt;p&gt;I get the point this person is making, but at times (and depending on language) it&amp;#x27;s the fastest and most efficient option. &amp;quot;Oh, the value is not what I expected&amp;quot; -&amp;gt; fix -&amp;gt; &amp;quot;value is good after testing, can remove the debug print&amp;quot;.
It&amp;#x27;s not elegant, yes, but it does the job with zero preparation and &lt;i&gt;works for every language&lt;/i&gt;.
Now if things are so hopeless the debug print doesn&amp;#x27;t even work, then yes, get a proper debugger.</text></item></parent_chain><comment><author>ajross</author><text>&amp;gt; You can pry my debug prints from my cold, dead hands.&lt;p&gt;I clicked on this about to type exactly that phrase.&lt;p&gt;Here&amp;#x27;s why: the &lt;i&gt;CORE PROBLEM&lt;/i&gt; of debugging has nothing to do with process, it&amp;#x27;s the need for the human developer to understand the operation of machine code when faced with a specific set of runtime conditions.&lt;p&gt;You can&amp;#x27;t debug by just reading code, because the bug only shows up at runtime.  Most people agree with this.&lt;p&gt;Likewise, you can&amp;#x27;t debug just by &lt;i&gt;WATCHING&lt;/i&gt; a program, for the same reason.  You need to be reasoning about the operation of the abstracted code at the same time.  And almost always you need to be inspecting and reasoning about the internal states driving the behavior.&lt;p&gt;Debugging tools, as nice as they might be, can only do the &amp;quot;watching&amp;quot; part.  They are a fine way to do it, but you still need to be making the decision, based on careful analysis of the code, on which elements to watch.&lt;p&gt;So... given that you&amp;#x27;re staring at code in your editor and thinking about how to extract the needed internal state to validate your predictions...  why not just print it?&lt;p&gt;That is: print&amp;#x2F;console debugging isn&amp;#x27;t a hard task you &amp;quot;have to do&amp;quot; in the absence of a fancy debugger, it&amp;#x27;s &lt;i&gt;exactly the task that you must do&lt;/i&gt; if you&amp;#x27;re going to solve the problem.  The fancy debugger, at best, is only saving your the time taken to &lt;i&gt;TYPE&lt;/i&gt; the printf() expression.  And in practice even that tends to parallelize with the analysis in my experience, as you realize things while typing out their expression.</text></comment>
<story><title>Print Debugging Should Go Away</title><url>https://robert.ocallahan.org/2021/04/print-debugging-should-go-away.html</url></story><parent_chain><item><author>falsaberN1</author><text>You can pry my debug prints from my cold, dead hands.&lt;p&gt;I get the point this person is making, but at times (and depending on language) it&amp;#x27;s the fastest and most efficient option. &amp;quot;Oh, the value is not what I expected&amp;quot; -&amp;gt; fix -&amp;gt; &amp;quot;value is good after testing, can remove the debug print&amp;quot;.
It&amp;#x27;s not elegant, yes, but it does the job with zero preparation and &lt;i&gt;works for every language&lt;/i&gt;.
Now if things are so hopeless the debug print doesn&amp;#x27;t even work, then yes, get a proper debugger.</text></item></parent_chain><comment><author>db48x</author><text>&amp;gt; it works for every language&lt;p&gt;This is really the problem. Nobody has spent time and money to make debugging _good_ in the languages you use. Few people pay for good tools any more, and only a tiny fraction of users ever contribute improvements to the open–source tools they use (paid or otherwise). So the average debugger hasn’t gotten better since the 90s.&lt;p&gt;I do programming in multiple languages too. In those where I can use RR and Pernosco, I use them every time. In those where I can’t, I miss RR and Pernosco every single time.</text></comment>