Get a Debugger Already

Using print statements and logger calls is no way to debug your code. Sure, print and console.log are great in a pinch, but:

  • Inevitably a bunch of print statements or trivial logger calls will get committed when the developer forgets to remove them. Debugger watchpoints and breakpoint usually don’t leave artifacts in your code.
  • When you use a debugger, you quickly drop some bad habits like mixing computation with logic in comparison statements. This leads to much cleaner, easier to understand logic.
  • Surprising behavior is often surfaced quickly in a debugger. Stepping through library code often takes the mystery when your code doesn’t do what you expect.

In the end, sure, you can do without a debugger. But if you take the 20 minutes it takes to learn to use one, you will become a much better developer in any language you use.

You also will not have have to deal with removing all the print an logger calls before you commit your code… because with a decent debugger you don’t need them.

Note: Yes, you can do without a debugger. Yes, reasoning through your code without a debugger can help you write better code. That said, when you start adding print statements to see what is going on, it’s time to do it with a tool that doesn’t leave artifacts in your code.

Leave a Reply

Your email address will not be published. Required fields are marked *