just found this on Twitter
just found this on Twitter
I use a debugger every day. It’s how I verify the code I write is behaving as I expect. I also use it to step through a new code base that I need to understand. I mostly build web applications in C#, C++, Python, and PHP, and use Powershell for scripts. I use debuggers in all languages. I’ve even simultaneously attached two debuggers to a single application written in two languages. The absence of a good debugger is why I won’t touch Ruby. The difficulty of using a debugger is why I don’t like Java.
In short, mastering the debugging tools has been the secret to my modest success. While another programmer has to recompile their application after adding a printf(), I can craft a quick command at the gdb prompt that behaves just like a printf and save myself minutes of recompilation time.
I’m checking out Julia, so I Googled “Julia debugger” and arrived at this page. Julia has so many other features I love, but I’m worried I won’t be able to understand the language without a debugger, preferably integrated into Visual Studio Code, but even a simple command line debugger would help a lot.
I haven’t used it too much yet, but so far so good with Rebugger.jl.
It’s definitely possible to do all sorts of crazy things with Rebugger.jl + Revise.jl, so that’s fun. Some of the “trigger specific methods within existing packages to recompile” stuff that you can do in Julia really gets to be mind-blowing (e.g. it’s amazing that something like Rebugger is even possible since it doesn’t even work like a normal debugger, as far as I understand at least).
On a closely related note, type piracy might not be a good idea as a general practice but it can be damn awesome when you are just screwing around. The pirate’s life for me.
Thanks for making Julia, a lot of features are really good, and I was about to switch from MATLAB to Julia for my PhD project, until I saw that there wasn’t any debugger available with breakpoints and stepping. For me this is a make-or-break feature to have, so I wish you good luck designing and implementing it! It could be a bit clearer that there isn’t any effective debugger available, it would have saved me some time today…
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 .
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!
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.
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.
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.
‘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. https://docs.julialang.org/en/v1/manual/workflow-tips/ + 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.
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.
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.
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
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.
But it really depends on which problem you are trying to solve. I had stiff differential equations to solve.
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.
Pitching to the choir!
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.
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.