[thelist] debugging tip

Sarah Sweeney mr.sanders at designshift.com
Wed Jan 26 09:36:31 CST 2005


> When you're looking for the cause of an error in a scripting language, 
> and you have to print something out to the screen temporarily in order 
> to determine the cause of the error (e.g., you have to print out a 
> generated SQL query), use a syntax that you don't generally use as part 
> of your normal coding style in order to make it easier to get rid of the 
> temporary code when you're done debugging.

Here is another debugging technique that I like to use:

<tip type="debugging" author="Sarah Sweeney">
Write a debug() function in your server-side language of choice, then 
use it to output variables or other information you need to use in your 
debugging efforts. Calls to the function will be easy to locate and 
remove from your code later on, and you can use a global variable or 
IP-detection to determine whether or not to output the debugging info at 
all; that way, if you forget to remove a debugging statement from your 
code, the end user is less likely to see it.
</tip>

-- 
Sarah Sweeney  ::  Web Developer & Programmer
Portfolio  ::  http://sarah.designshift.com
Blog  ::  http://hardedge.ca


More information about the thelist mailing list