May 1, 2009, 6:39 am
I often ask other developers for advice. At times, the counsel reinforces my approach; at other times, the guidance challenges my thinking, leading me to refine my code or even pursue a wholly different solution.
Out of curiosity, I also ask other coders about debugging techniques, and more often than not, I am surprised by the answer. Believe it or not, the vast majority relies on liberal ‚Äúprint‚Äù statements sprinkled throughout code. Of course, ‚Äúprint‚Äù takes many forms‚Äîdump pertinent data structures, emit trace statements to standard error, and log interim results in a separate file‚Äîand there are cases where these methods are mandated. Still, it puzzles me why more skilled developers do not use a debugger. Extensions to PHP allow for interactive forensics; Perl running within mod_perl supports debugging; and Ruby on Rails‚Äôs Mongrel provides the ‚Äìdebugger option to interrupt execution and drop to a debug console.