Stop Being A Trace-a-holic and Start Using the Debugger
Rather than inserting trace() statements all over your code, forgetting where you put them, and then let another developer decrypt them or worse, obfuscate another developer from trying to understand the output, you ought to train yourself to use the Eclipse-style debugger.
It’s simple enough that you set up your breakpoints and then run the main file under the Debugger perspective. At runtime, the program will halt at the breakpoint and yield you a model of all the objects in memory at that time in the Variables tab of the Debugger perspective. The Debugger UI gives you a great amount of control of how deep you want to drill into the object model at the time the program is frozen. Press the “Play” button to resume control flow which will continue until the next breakpoint.
Once you’re done analyzing your problem, you can hit the “Clear All Breakpoints” to clear all the points of debugging interests in your application. It’s a quick and dirty approach without investing into logging.
* * *
In related news, Mike Morearty is delivering a presentation on the Flex Builder Debugger at 360 Flex @ Seattle …
About me (Mike Morearty)
I’m a Senior Computer Scientist at Adobe. Since I’m a scientist, I always wear a white lab coat. I currently work on Flex Builder, the IDE for Flex. I work primarily on the debugger portion of the product. I have a fondness for debuggers. Before Adobe, I spent ten years at Microsoft, where (among other things) I worked on Visual Studio’s debugger for a number of years.





June 6th, 2007 at 12:26 pm
Question: For the next version of the Flex IDE, can you include Mouse-Over debugging similar to that of Visual Studio so you don’t have to expand all the items in the tiny tree view?
June 8th, 2007 at 11:30 pm
Funny you mention this. It is not possible in Flex 2 IDE but in the next Flex 3 IDE
http://www.morearty.com/blog/2007/06/08/flex-builder-30-sneak-peek-debugger-tooltips
Cheers to tooltips instead of constrained tab of varables!
January 18th, 2008 at 4:34 am
Why can’t I set breakpoints in the included .as files. When the code is inline in the .MXML file, everything works fine. but if I use the tag source=”myfile.as” none of the breakpoints get hit. So I have to keep using trace statements!