Inevitably during your development process, the client is going to want to see how things are going. And typically in these cases you don't want to demo on the actual development environment. So you setup a test site to demo everything which may or may not contain all those lovely Drupal development modules (i.e. coder, devel, etc...). And if that's true, what if there are stray 'dsm' calls in your committed code? I mean it's safe to assume you grabbed a copy from your repo which is still under active development so it's safe to assume there's some dev code in there. And that code will cause critical errors with those dev modules missing. The last thing you want is to show big error pages during a demo!
Now I know this is a lot of if's but it could happen (trust me...). Here's how to avoid it:
What you'll need: Your fingers and cooperative developers
How to do it: Anytime development code is committed to your repository, get your devs to wrap any development function calls in a ternary operator with the 'function_exists' function call.
Example:
function_exists('dsm') ? dsm($node) : '';
Now if 'dsm' is missing, your code will execute just fine. But don't leave all those 'function_exists' calls in your production copies since they do slow down the PHP execution (especially if you've got a lot of them). But it can save you some embarrassment during early demos.
Until next time!
