Debugger vs Print Debugging

This cluster debates the effectiveness, productivity benefits, and personal preferences between using interactive debuggers and print statements (like printf or logs) for debugging code. Commenters share experiences on when each method excels, with some advocating for debuggers and others preferring prints or mental reasoning.

➡️ Stable 0.6x Other
6,041
Comments
20
Years Active
5
Top Authors
#8100
Topic ID

Activity Over Time

2007
3
2008
37
2009
103
2010
103
2011
192
2012
211
2013
177
2014
188
2015
266
2016
349
2017
306
2018
332
2019
503
2020
368
2021
684
2022
534
2023
541
2024
523
2025
603
2026
18

Keywords

WHY SEO PHP AI REPL e.g debugging.html ML OK FWIW debugger debuggers debugging print code debug rarely statements printf logging

Sample Comments

mcguire May 5, 2014 View on HN

Bah! If you need a debugger, you're not thinking hard enough.

nradov Aug 18, 2023 View on HN

You are doing something wrong. There are huge productivity benefits in learning how to use a debugger effectively. Debuggers have benefits that go beyond just fixing known defects. I have disciplined myself to step through every line of code that I write while watching the control flow and state changes. This allows me to proactively find and resolve defects and inefficiencies that would have otherwise leaked through testing. Issues that you would never notice while reading source code or lookin

tjpnz Jun 2, 2020 View on HN

I'm somewhat embarrassed to say that I very rarely use debuggers. Print statements have always worked for me even in large codebases. What am I missing here?

betageek Oct 3, 2018 View on HN

Learn how the debugger works for whatever language you use. You will be very tempted to just use logs as it's way easier and debuggers seem intimidating, but take a day out of your schedule to learn the debugger. When you really have no clue what's going on in your code there's no substitute for being able to stop your program mid run and inspect it's state interactively.

oreally Jun 4, 2022 View on HN

Tools help you be more productive. The keystroke reduction in using debuggers far supercedes print debugging.Imo you've blamed tool fetish when it's really inexperience that is the problem.

AgentME Aug 11, 2016 View on HN

A world where most people don't use debuggers?

jasonhansel Jan 18, 2019 View on HN

Agreed! Personally I've found that I can find and fix problems much faster with a few print statements than with a debugger--debuggers can make it harder to trace through the full execution of a program.

jedimastert Apr 25, 2021 View on HN

I always feel like I should get better with a debugger, but whenever I'm debugging I always fallback on printf and crashing. It just feels so immediate

jstimpfle Feb 24, 2019 View on HN

You think that print debugging is wrong and debuggers are the way to go?

Debugger usage has been non-monotonic with time for me. When I first started coding I would print. Then I discovered debuggers and experienced a massive improvement in productivity on bug fixing and problem solving tasks. But over time I found myself reaching for the debugger less and less often as I became better at solving problems. In the last 5 years I have to admit I've barely used debuggers at all.