2012/02/28

le bugs, le bugs! debugging like a boss

okay, writing code is sometimes easy, sometimes hard, but it's walk in the park most of the time, when compared to bug hunting.

PHP and JavaScript are, usually, easy to debug. after all, if display_errors is turned on in your PHP configuration, you get first-hand notices of anything that went wrong (and i suggest setting it so that it displays ALL warnings, notices, deprecated uses and so on -- you need to write code that is flawless and up-to-date, regardless of anything anyone may say). for JavaScript, you have the javascript error console in most vanilla browsers (except for IE, where JS error display sometimes may be... less than informative; but IE is a bastard in many other regards as well).

trouble comes when there is no error display and your application just doesn't work.

of course, if you do development in a fairly complex IDE, you should have debugging tools at your fingertips, but setting them up and using them may sometimes be clunky and confusing. so, instead, let me share you my tips for debugging.

and for starters: debugging is:
  • isolating and identifying the point(s) in your scripts where something works not as expected,
  • identifying the data causing havoc,
  • correcting them both.
debugging is the toughest part of any development, but it is a step that cannot be avoided. we must do all in our power to deliver bug-free code that works as expected. period.

in the following articles, i'll show you tips and tricks to make debugging easy.

rule zero: if you use any languages, technologies and extensions, READ THE MANUAL before you start coding away -- you can save yourself tremendous time and effort. especially consult the known bugs/errata/issues part of the documentation, because it is very possible that even if your code and data is bug-free, the system you are using might contain inherent faults which you have to circumnavigate to get the desired results.

for PHP and AS3, using the online documentation is a treasure, because they contain user-written additions that might point out inherent flaws or special behaviour not necessarily found in the official documentation.

now, let the series commence!

No comments:

Post a Comment