How do you use debuggers?

I don’t disagree, but I have come to recognize the need for a debugger as a sign of code smell in Julia. Ideally, well-written Julia code consists of small functions that do one thing, and can be unit tested as building blocks of a larger solution.

I agree that one does not always control the quality of other’s code, and a debugger is occasionally useful. But I also think that scientists without a lot of programming experience

  1. have a bias towards large monolithic functions,
  2. tend not to be aware of the existence of unit tests,
  3. instead, the approach is “when it errors, we use a debugger”.

So when I see something that would require a debugger to, er, debug, I have an itch to refactor the whole thing. Or rewrite it from scratch. Otherwise, I can’t trust the quality of that piece of code, so it is worse than useless.

That said, what I would find really useful is as an interim solution is the ability to inspect function arguments in a stack trace.

11 Likes