Hacker News new | ask | show | jobs
by amitoz_azad 2192 days ago
Yes, the jupyter notebook thing, rightly pointed out by you, it does give a quick feedback. One can also start writing code from the beginning in it and push a working cell into a .py file. This way one is very sure from the beginning that how the code will work. The downside of it, which I think, it feels to me that code is written in a very linear fashion.

Coming to debugger in python (pdb), in your blog you criticize using debugger to step line by line. But this need not be the case, one can jump to debugger prompt and set a break point from the prompt itself where one feels something is wrong and continue to that break point and repeat this process. So one need not to jump through each line. In such a case it works equivalently to carefully put print statements, i.e judiciously put print statements = judiciously put breakpoints, what do you think?

1 comments

I think a lot of people that criticize debuggers think professionals use them like a first year CS student, as a crutch because they don't understand the language they learning.

A professional uses them to trap events and then explore the programs state. And to inject faults and watch how the program explodes, or not. In that debuggers are vastly better than printf debugging.

"a lot of people that criticize debuggers..." But what really making me think is that big giants like Torvalds, Rob Pike, Guido van Rossum. Rober C Martin, John Graham they don't like using debuggers (https://lemire.me/blog/2016/06/21/i-do-not-use-a-debugger).
That article is a great example: It defines "debugger" as "single-stepping through code", and then argues against that. It's fine to argue against "single-stepping through code" as a default technique, but artificially limiting the scope.

EDIT: one of the comments by the author makes it very clear: they don't consider lots of things you can do with e.g. gdb as "using a debugger": https://lemire.me/blog/2016/06/21/i-do-not-use-a-debugger/#c... </EDIT>

The submitted article here is similar, by opening with that ridiculous example and pretending that's what using a debugger means. Debuggers don't make you bad at finding problems. Not knowing when to use which tool makes you bad at it. (And knowing how to make new tools out of your existing ones is also quite helpful)

This is a good point, thank you! I am adding a quick note in the article to clarify that it's more about the code-stepping technique itself.