Wednesday, December 15, 2010

One of the Most Powerful Debugging Practices

Dzone promoted a link called "One of the Most Powerful Debugging Practices," showing the use of a trap. The example is in C#, but a Java version is offered. Interesting thought - worth it?
Add Trap() instances all over the place to cover all the execution paths and have it throw a runtime exception so that the debugger would pick it up and help you step run through the immediate code path following the trap.
Once the debugging is done prefix the trap with a ** mark so that it can result in a compilation failure so that peice of code can be removed.
So essentially if you use a debugger this sure is handy in having all the execution paths tested, if not then there is little value addition.

1 comment:

DavidThi808 said...

Thank you for the mention.