OZONE Asylum
FAQ
How to properly debug a server side program
This page's ID:
4966
Search
QuickChanges
Forums
FAQ
Archives
Register
You are editing "How to properly debug a server side program"
Who can edit an FAQ?
Anyone registered may edit an FAQ.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Programming takes logical thinking. Straight, logical thinking. With this in mind, our mood, emotions, feelings, beliefs can influence our tendencie to make mistakes while programming. I'm talking about those times when you think "dare I do that, won't it crash my machine? Will I reduce my hard drive to a toast by pressing this little button?" Well, understand that if you can press the little button, it is probably that it won't destroy anything in an irreversible manner. Otherwise, the creators of the machine would have kept the "fatal trigger" hidden. Anyway, the point here is a quick list of what you can do to properly debug your own code: - know the language error messages No matter the language you use, it has it's own warnings and error mesages. Learn what they mean, either from the manual, either by experience. Tipically, in php or asp or javascript, these warnings report the line where the error occured, it helps spotting the problem and often, the solution. - track and display your variables and their values There always is a simple way to display the value of one, or several variables. It is probable that you know which values you can expect from which variable, what it should contain, or at least the type of the variable. Being able to inspect those variables and how they evolve during execution, you'll spare yourself some headaches. Especially when it comes to errors... That don't throw a warning. - test your configuration Moving from one server to another, one environment to another, things could change and cause a correct code to react oddly. Get to know your working environment, tipically, moving from a windows Apache to a Linux Apache, or a PWS to an IIS. - test functions separately Something in your code is wrong and you suspect it is in "that" function? Isolate the function, make it a stand-alone thing, and things will get a lot clearer. - ALWAYS backup your working files You just achieved something *great*, well, take that good habit to backup you file(s). If possible, make a bakcup of the whole program each and every time it is needed. If you leap some of these steps, you could find yourself strongly fixed to a false idea of what the error could be. Because your (and my) human mind will tend to discard what seems unprobable. Do like Sherlock Holmes used to do: programming is about logics, logics is about straight facts, discard all the possibilites, one by one, and what remains, even if unprobable, will be the truth. [small][i](Added by: [url=http://www.ozoneasylum.com/cgi-bin/ubbmisc.cgi?action=getbio&UserName=InI]InI [/url] on Tue 21-May-2002)[/i][/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »