Re: PHP debugger

From: Date: Sat, 26 May 2007 14:30:19 +0000
Subject: Re: PHP debugger
Groups: php.general 
Request: Send a blank email to php-general+get-255680@lists.php.net to get a copy of this message
Miles Thompson wrote:
Suggestions will be most welcome. Also, I'm not married to this, so if anyone thinks there is a better debugger, please jump in.
The following assumes object-oriented programming paradigms are at least somewhat applied. I would guess functional would be similar, but procedural code, you might be on your own there... I actually use two classes that I include at the bottom of all of my library definitions (in if(!class_exists()){declare}format). One provides warning and error message storage, the other type assertion. Between the two of these, I have simple unit testing that I can perform as I am developing a class, as well as pre-included simple error logging that, when I install into the greater system, can be incorporated into the systemic error catching routines without refactoring code, in most cases to weld-on systemic error routines. Thinking aloud, getting code to work correctly usually means testing it against what you expect it to do, so doing that at a very localized level first can be helpful. Once I started doing this, my implementation issues somewhat went away. Results (and implementations) may very.
PS Why are we doing this? Because we are getting tired of debugging with Javascript alert() boxes. /mt
Firebug in Firefox is a very well-developed javascript debugger, featuring console.log(), which allows you to stop using alert() for error checking. Very nice! And I put this: <code> // Solve the firebug extension issue in IE by try/catching and creating a blank object console.log(); try{console.log();}catch(e){var console=new Object;console={log:function(){var k=0;}};}; </code> At the head of each js file to prevent errors in IE or other browsers without Firebug installed. Example: http://web3.unt.edu/riskman/JS/lem.json.js -- Jared Farrish Intermediate Web Developer Denton, Tx Abraham Maslow: "If the only tool you have is a hammer, you tend to see every problem as a nail." $$

« previous php.general (#255680) next »