Thread on debug by print vs debuggers

I'm pleasantly surprised that so many people care about debug by print. I've always felt like a lone voice before when talking about it. Great!

I think this conversation is missing the point, though, about what makes debug by print special. The key skill it teaches is reasoning about a program by modifying it. Interacting with your program in all its depth, rather than just through a pane of glass.

@akkartik It's funny because as a noob, debugging by print is already the most reliable way to figure things out, printing is the first way you learn to get your data out of the program in most cases. It tells me everything I need to know. What's coming down the pipeline, how it's mutating compared to the expected results, if not then at what point in between did it screw up, and then narrow it down. I only use stepping at the in-between section if either the output is too larger --

@akkartik -- or I can't pin-point it immediately.

I guess it depends on the scope of your project but stepping through often seems redundant, having to either type continue after every step vs piping the print statements out to a file along side whatever data you're expecting and grepping your point of interest and see what shows up.

Like I accidentally pushed this to my repo.


@akkartik I was looking for 16 numbers in this array that weren't suppose to be showing up. It was easier to pipe it out in a massive blob with print and grep it than it would be to step through each line individually. It tells me literally everything I need to know along the way.

· · Web · 0 · 1 · 0
Sign in to participate in the conversation

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.