"The most effective debugging techniques seem to be those which are designed and built into the program itself."
- Donald E. Knuth (1993)
For all of the wonders of full scale Debugger debugging (as possible with XDebug + NetBeans IDE, see the external links), there is - despite all protestations from certain Drupal contributed module coding standard devotees - still much to be said for leaving debug statements right there in the code using the Devel module's
dpm() or other debug functions, possibly under further masking control of a simple
define('MYMODULE_DEBUG',TRUE/FALSE) switch, or under the control of a module-specific DEBUG mode switch settable via a Drupal form.
Although this is definitely frowned upon in Drupal contributed modules, when developing custom modules for a client who does not care and will never see, such debug statement in code can leave (as Knuth and many others have observed) a very useful commentary record about what was done and why. I am not talking here about massively littering the code with debug statements that are basically mere dpm() echo statements, I am talking about informative debug statements that can, for example, be switched back on if needed on a STAGING Drupal instance, where full Debugger debugging is usually not practical anyway.
Besides, if Angie Byron of Lullabot is allowed to HACK drupal_set_message() to include debug_backtrace(), I am allowed to use
dpm() and lowly friends.
Now enjoy the rest of this zone to find out some fancier ways of debugging Drupal it (that may or may not bring additional benefit).
Dr Darren, The Drupal Heretic
© Copyright 2001 - 2016 Webel IT Australia (ABN: 67 677 268 579). All rights reserved (except as specified below).
PHP code examples from Webel IT Australia on this site are distributed under the GNU General Public License.
Excludes text and code snippets from Drupal.org quoted for educational purposes.
Drupal’s online documentation is © 2000-2014 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0.
PHP code from Drupal.org is distributed under the GNU General Public License.
Drupal® is a registered trademark of Dries Buytaert.
Text quoted from Wikipedia for educational purposes is made available under the Creative Commons Attribution-ShareAlike License.
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
Site developed by Webel IT Australia.