Dynamic Debugging


Mathematica 6 introduced a novel and unique technology for building user interfaces that are embedded in notebook documents. The new technology is based around Dynamic components that are embedded in user interfaces and graphical elements. These work both as an event function, tracking changes in state, and also as an object model, allowing parts of a structure to be modified. It can be contrasted with the more traditional approach offered by GUIKit. Information about the technology can be found at http://reference.wolfram.com/mathematica/guide/CustomInterfaceConstruction.html.

If you want to work with Dynamic in Mathematica 6, you can use the Workbench to help with debugging your implementation.

Launching

You should launch Mathematica in debugging mode.

Debugging

Now you need some code that is called by a Dynamic computation. The code should reside in a Mathematica project. For example, here is some code.

Dynamic

This makes a nice simple interactive graphical example; as you move the locator, the spiral moves around with it.

Dynamic

You should now set a breakpoint in the code.

Dynamic

When you move the locator in the notebook, this triggers the breakpoint. This is a typical display of the Debug view.

Dynamic

Some Notes

When you are at a breakpoint, the notebook front end is waiting for the result to the computation. Since it cannot proceed, it will become unresponsive until execution continues. This is typical for debugging a user interface application.

Due to technical details, you cannot debug Dynamic when the Mathematica kernel is already busy. For many useful applications this is not a severe limitation, and one day it will be removed.