The name programmer for those who spend their time developing web applications is misleading: the vast majority of time one spends "programming" is actually spent debugging. Whether you're fixing typos or refactoring chunks of code that are performing poorly in a heavily loaded production environment, odds are you'll spend a large amount of your career debugging and testing, and debugging and testing again. And again, and again, and again.
The raucous party that is a frantic, all-night debugging session was probably omitted from your job description'who would sign up for that kind of fun? The fact is that errors, bugs, debugging, and testing are a part of the programmer's life. If you face this head on with good practices and techniques, you can minimize the time you spend debugging and maximize the time you spend on the good stuff.
Unfortunately, many developers don't spend much time building error handling, debugging, and testing skills; don't make the same mistake. If you employ what's affectionately known as pessimistic programming, you'll begin to plan for things to go wrong'and your application will be prepared to handle it gracefully during those moments.
Recipes 20.1 through 20.11 deal with errors: finding the source of errors, determining what was going on when an error occurred, hiding errors from end users, and logging errors so you can conduct informed debugging sessions after the error occurs.
Recipe 20.12 explores the use of Xdebug, an open source PHP extension that allows for line-by-line debugging in real time, along with a robust set of code-profiling features.
Recipes 20.13, 20.14, and 20.15 explore the world of unit testing in PHP, and show you how to turn your fixed bugs into a test suite that can help you ensure that once a bug is fixed, it stays fixed.
Recipe 20.16 introduces you to XAMPP, an easy way to set up a testing environment on your local computer, so that you can work in a sandbox environment without fear of breaking a production web site while you're trying to determine what's gone wrong.
Developing good debugging and testing habits is the thing that many developers put off for the longest time. Don't wait until the next project to start learning good practices; if you do, you may never get to it.