[nycphp-talk] Learning to program the right way
David Krings
ramons at gmx.net
Fri Jan 27 13:14:15 EST 2012
On 1/27/2012 10:14 AM, David Mintz wrote:
> I could not possibly imagine living without Firebug and FirePHP. I am thinking
> more along the lines of XDebug.
Never used Firebug and FirePHP, but I will take it for a spin...when I ever
get around to do some PHP coding again. Years back I looked around for good
implementations of a PHP debugger and ended up going back to the 'source' of
one using PhpED from Nusphere: the DBG debugger. In a nutshell, whatever you
want to echo you can do with a debugger, and even more as you can do that
before output is supposed to start or when there is no output at all. I tend
to create separate script files depending on functional area
(input/processing/output) and the processing files never generate any output.
Throwing an echo in there would only add code that I have to take out
later...and potentially forget about.
Debuggers also show you the content of all variables and arrays and system
values at a breakpoint, which is another benefit, because with break points
you can continue on, which an echo it is not that easy, especially when the
actual output with proper html header is yet to follow (and will fail).
There are a few implementations of DBG in other editors that do not work
across separate scripts, which is just useless. But no matter which debugger
you have available, learning the basics of how to use it is time well spent.
Other tools worthwhile to learn how to use are a profiler and
phpdocumentor....unless you don't care about creating docs and flowcharts and
stuff like that for others.
David
More information about the talk
mailing list