Elegant debug statements


youtubeoi10.pngI recently uploaded an OpenInsight 10 lesson and at the beginning of the video I talk about a rogue debug statement that I had left in my code in the previous video (on purpose you understand).

Mark Marsh (Professional OpenInsight Application Developer) emailed me with an extremely useful tip to using debug statements in code and which will avoid the issue and embarrassment of leaving a rogue debug statement in your code.  It is also great for those of you with OpenInsight development teams because the trick is user specific.

I’d like to offer Mark a huge thank you for sharing this invaluable tip with me and for enabling me to then share it with you.

You can see the video here and the tip is in the video comments – it’s well worth a look.

Advertisements

2 thoughts on “Elegant debug statements

  1. Matt Crozier

    When debugging code, I use debugger Breakpoints wherever I can in preference to hard-coded Debug statements. This leaves the compilation alone – prevents deploying breaking code, and nice if you are relying on the compile date for generating deployments.

    A Breakpoint can be set in the debugger by opening the source code from its File menu then double-clicking on the line in the Source box where the breakpoint should be placed, and the line will turn Blue. Breakpoints can also be managed from the Breakpoints menu.

    Admittedly I’ve found (in OI 9 at least) that there are some scenarios where this doesn’t work and you have to hard-code a Debug, but they are rare.

    Cheers, M@

    1. Many thanks Matt. I’ll have to look into this and try to incorporate it into a future video along with Mark’s solution. As usual, many solutions to the same requirement but I’m loving the flexibility of being able to choose which works for me at any given time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s