Group Abstract Group Abstract

Message Boards Message Boards

6
|
22.2K Views
|
13 Replies
|
40 Total Likes
View groups...
Share
Share this post:

Is there a real debugger in Mathematica?

Posted 11 years ago

To my surprise I realized Mathematica doesn't have a proper debugger -> I can write only toy small programs without an easy way to debug the code

I searched The internet and I found Workbench tool ....which is not free !!! How am I supposed to use the tool in the first place if I cannot develop any decent size program? Is this a bad joke ?

POSTED BY: Bogd Timo
13 Replies
Posted 6 months ago

So, (and I'm in 14.1), why have the Evaluate->Debugger menu item at all if it's not going to be documented and taught? What am I missing?

POSTED BY: Paul Nielan
POSTED BY: W. Craig Carter
Posted 11 years ago

I inquired of tech support about this debugger some time ago, asking for a source of information on its use. The response I got was that they really intended Workbench for that purpose, and had no further information. This led me to believe it was an early idea and now abandoned, but with a vestigial remainder.

If anyone gets a better answer, I would really like to see it posted here.

POSTED BY: David Keith
POSTED BY: John Fultz

Thanks for the clarification.

I can understand the caveat about debugging generated (graphical) interfaces, but in my experience (not just with Mathematica), debugging the UI is one of the most useful functions of a debugger.

What does Wolfram use internally to debug interfaces? Is is something that you could make available to an advanced mathematica user -- similar to the Workbench? (If I recall correctly, the debugger in Workbench is a bit more robust, and it may have this functionality already.)

I'm not personally a Workbench user, but I do believe that some use it for this purpose.

But most of the time, the code in the interface splits cleanly into code that's managing the interface, and code that's taking inputs from the interface and doing work. The code that's managing the interface doesn't, in my experience, really require much in the way of debugging...the entire experience is already very usefully visual, with hints such as the pink boxes to help you when something is throwing error states internally. As for the remainder of the code, I'm always testing/debugging it outside of the interface first.

I.e., if I'm writing a significant body of code that's going to live inside of a Dynamic, then I'm debugging/testing it outside of the Dynamic first, and I'm writing it in such a way to make that very easy to do. For example, I often see bug reports or complaints that such-and-such doesn't work in a Manipulate. The very first thing I do is to strip the Manipulate off, and see if it works without the Manipulate. And you know what? About 90% of the time, that's where I find the problem.

This leaves one legitimate area of development not very well covered, though, and that's highly responsive UIs. I.e., UIs that shift and change in significant ways in response to how you use them. Perhaps you might find Workbench useful in such areas. I find other means (a combination of LinkSnooper, Assert, various forms of printing/logging, etc.).

POSTED BY: John Fultz
POSTED BY: Szabolcs Horvát

Thanks for pointing this out. I completely missed it.

I'll check it out. While it looks to be a bit spare compared to other modern debuggers, it should meet a need.

It might be nice if Wolfram Research provided a seminar about this, and other more advanced functions for programmers.

Posted 11 years ago

While I haven't used it, under the Evaluation menu for both Mathematica 9 and 10 (and maybe earlier versions) there is the menu item "Debugger". There isn't much in the documentation on this but what features is it missing that keeps it from being a "true debugger" ?

POSTED BY: Jim Baldwin

There is new unit testing functionality in Mathematica 10. I have not used it yet, but I plan to.

For Mathematica, I pretty much follow David Park's method of gradually building up functionality. It works very well, and if done properly, reduces or eliminates the need for a low level debugger.

When I started programming, there were no debuggers, at least not in the modern sense. I learned my craft in a way that is not that much different from the way I create Wolfram Language code. It also works well for languages like objective c or ANSI c. Most of the time when I 'needed' a debugger was where I had been sloppy in my coding.

I had a major c project involving thousands of pages of code. It works -- it is a real-time app that is up 24/7 and never crashes. I could rewrite the app using Wolfram language using a hundred pages of code, and I don't think I would need to use a low level debugger at all.

I think that the main point for you would be that Wolfram Language is not like c, c++, FORTRAN, or [insert favorite language here]. If you approach Mathematica the way that you treat these other languages, you will be fighting against the Wolfram Language, not using it to its full potential.

You can use Mathematica as a super graphical calculator and never run into these issues, but you can do so much more if you can undergo a paradigm shift. You may find, as I did, that your coding in c, etc. is improved from this new viewpoint.

You get quite far with Print and Dialog[] statements put into your code.

You could also try this code. Workbench is free if you have Premier Service.

You could also try to use the excellent IntelliJ plugin

But yes, a true debugger and profiler, usable from with the Front End, would be most welcomed. Too bad Wolfram Research seems to be not so much developer oriented anymore as it once was.

POSTED BY: Rolf Mertig
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard