Page 1 of 1

Debugging - Best tools and practices

Posted: Fri Nov 21, 2008 2:28 pm
by lockerrushing
Hi,

Can anyone tell me if there is a way to output var_dump() or print to a console like a gdbp client? It just seems wrong to mix in debug info with the web app on screen.

Trying to understand the app I'm working with. Just want to be able to drop in dumps throughout the app and see what's going on through a separate console.

Any guidelines on the best practices for debugging. I have been trying to setup xdebug with eclipse, and I have to say the process for a noob sucks! Why does it have to be so freakin complex?!?

Also, any recommendations on the best ide? Is Zend studio better then PDT? Is Zend Debugger better then XDebug?

Thanks for any help!

Re: Debugging - Best tools and practices

Posted: Sat Nov 22, 2008 6:07 pm
by josh

Re: Debugging - Best tools and practices

Posted: Mon Nov 24, 2008 4:23 am
by Jenk
Create yourself a print_debug() function and use that instead of var_dump() that way you've got a central location to change where it's output goes etc.

I must ask, however, just for clarity - is this regarding Legacy code (Legacy code is code that does not have accompanying Tests/Specs) or are we talking about 'debugging' tested code?

:)

As for IDE's, I've not used Zend, but I liked PDT (and Eclipse with SVN/FTP/etc plugins) a lot.

Re: Debugging - Best tools and practices

Posted: Mon Nov 24, 2008 5:58 am
by josh
Eclipse has GUI debugging? I'd have to give it a whirl if it did. Heard good things about it

Re: Debugging - Best tools and practices

Posted: Mon Nov 24, 2008 11:52 am
by lockerrushing
Hey Jenk, thanks for the reply. I'm working with an open source shopping cart. Just trying to get a feeling for the inner workings. So if I understood correctly, I should make a custom dump function and redirect the dump to an external console? How exactly do I do that part of it?

Thanks

Re: Debugging - Best tools and practices

Posted: Mon Nov 24, 2008 12:01 pm
by Jenk
Dumping to the console won't be easy, dumping to a file would be much easier. If you're on *nix, you could `tail -f` the file in a terminal if you want a 'live feed' as it were.