How do you use debuggers?

I wouldn’t give up so easy, if I were you. Julia is in fact so well-designed that in the past year or so I wrote a package of some 5000 source code lines, and I never needed a debugger in the first place.

In addition, there is now the Rebugger! People who tried it say it is great.

From my Matlab days I remember that the debugger was a must. But then again, Matlab to Julia is as a dirt dugout is to image .

10 Likes

Does anyone know what the status is on Juno Rebugger integration? Juno has so many repositories and packages that I can never tell what is going on, or even what is new in each release.

As for needing a debugger, I’m one of those who can never figure out what my code is doing without stepping through it. More than five lines of code and I need a debugger, never mind 5000!

3 Likes

Have you tried test driven development? Idea is to write your test first to define what your code should be doing and then just code until your test passes. This typically leads to really nice looking code space with a lot of well defined functions, which is really nice for the maintenance point of view.

3 Likes

I’m sure it’s a powerful paradigm. But it’s such a radical departure from my normal workflow, or even way of thinking, that it probably won’t be a quick switch.

5 Likes

Rebugger integrates into Juno in the sense that Juno supports a REPL console, but there is no stepping yet. I’m now convinced it is necessary, so it is on the TODO list.

9 Likes

‘when I was playing with heavy parallel programming on a cluster’

that’s exactly what most data intensive programs rely on.

Debuggers are pretty useful when working with stateful programs that grow beyond a size where you can keep the state in your head. When working in 100+kloc C++ OOP codebases I would be quit my job if there was no debugger.

The solution I like to use in Julia is to avoid stateful programming and test code on-the-fly in the Repl. Write functions that take immutable values and return values. Aside from ( usually large ) arrays being passed by reference, which is a necessity for efficient numerical programming. I think this is kind of how Julia is intended to be used. Workflow Tips · The Julia Language + the excellent Repl helper packages.

I haven’t once felt I needed a debugger in Julia yet, but I haven’t worked with large amounts of code written by other people yet. Still, I’d sure be easier to convince my colleagues to use Julia if there was a debugger.

Test driven development has gotten a lot of traction recently, but I find it can be too much and bloat out the already large codebase you have to maintain. You have to maintain tests as well. Quality over quantity for tests should be a focus.

4 Likes

Tests are costly to maintain, but not having tests means having (more) bugs, which is far more costly in most contexts. Also, TDD is a very specific development paradigm. You can (and should) still test your code well without subscribing to it.

4 Likes

Even ignoring the technical benefit, I find that having a thorough test suite is very helpful in terms of peace of mind, as I don’t need to get paranoid that I’m potentially breaking everything when changing things.

3 Likes

Didn’t intend to derail the conversation towards a discussion of testing. Was trying to proselytize Repl based development and how you can get along fine without a debugger. If you like finding bugs or the peace of mind of testing, you’ll love poking at your well designed function in the Repl until you are 100% sure it’s perfect! Save all of it to your test directory for posterity :wink:

3 Likes

Thanks for the reply Petr. I like that this forum is so active! I may give it a go, mainly because I feel code written in Julia looks prettier and more intuitive than in Matlab (which what you meant I suppose). At the same time, I feel I may still be a bit early and would be taking a risk for my PhD. (In addition to the lack of debugger, plotting is still a bit buggy.)

Well, if I would have had Julia for my PhD I would have saved a year of experimenting with Python, Numba and Cpp. :slight_smile:

But it really depends on which problem you are trying to solve. I had stiff differential equations to solve.

4 Likes

I don’t really anymore. I actually shudder at my coding style 15 years ago in C++/Delphi. No tests and great debuggers, stepping on through the code, all the time.

When a codebase is clean and small, with a good type system and succinct tests I rarely need a debugger. Most of my Julia packages are under 150 lines, which helps. The larger ones are very modular and structured and I can usually still keep all the state and control flow in my head.

But I really need a debugger to let my colleagues step through my modular code, as they are often used to more linear coding styles.

2 Likes

Pitching to the choir! :slight_smile:

Having a good debugger would just make me more efficient at certain times. ASTInterpreter2 was quite useful when I code in Julia 0.6 but for it to be useful my code needs to be very modular. That’s not a bad thing, however, because then I’m forced to design my program properly and make it more testable.

2 Likes

I think assuming that just because person A doesn’t need a debugger for his code implies person B shouldn’t need one either is a mistake. If you have a well defined problem that decomposes into a bunch of nice simple components, then using a debugger may not be necessary. However for scientific programming and signal processing work it’s essential for a timely workflow.

I usually am doing statistical signal processing on large dense matrices and data collected from sensors in varying environments. Often a set of algorithms that work in one scenario, completely fail in another. The quickest way to find out what’s going on is to step through the code. The algorithms often depend on a dozen finely tuned parameters. I need to inspect all these variables and see how they interact with the data in question. Print statements are a poor substitute for debugging with workspace inspection.

I would feel crippled without a debugger for these kinds of problems. A debugger just dramatically shortens development time and makes it easy to verify branch logic and so forth. So I hope Juno support with graphical debugging continues into version 1.0 and beyond.

7 Likes

Yes, you’re absolutely right. Don’t understand someone’s philosophy that you don’t need a debugger because I don’t find it useful for myself. If this is true, why does a thing called gdb exist?

3 Likes

Is someone actually saying that?

Debugging C-language (or C++ programs) is HARD. That’s why.

Yes.

No offense at all, but can I say that this is your own perception?

Oddly enough I probably use a debugger for my C and C++ code less than for something like Julia or Matlab. Usually if I’m rendering HPC operations into C, the algorithm has already been thoroughly vetted in a higher level language, or I’m implementing a known algorithm from a paper or text book. C in this case is simply giving me a performance enhancement.

Just thinking out loud, but I also tend to write a lot more test code for C. This approach simply doesn’t work as well for general algorithm development because it’s too hard to predict the vagaries of real data in advance.

4 Likes

30 posts were split to a new topic: Controversy on who said what on debuggers