Join Jon Peck for an in-depth discussion in this video Best practices, part of Debugging PHP: Advanced Techniques.
- View Offline
As a programmer, I'm very aware that for every problem there are multiple solutions.…With that in mind, here are a number of best practices that I recommend …for building optimal scalable solutions.…One of the challenges faced as a developer is finding exactly where the bug is.…Using debugging break points, there is a technique known as binary split.…In short, set a breakpoint halfway through the program.…If the problem does not occur, set a second breakpoint halfway through the second half.…Otherwise, put the second breakpoint in the first half.…
Keep putting breakpoints in the middle of the halves to narrow down where the…problem is occurring.…Using this technique, I can limit the search area of a thousand line program in ten steps.…Being able to track changes over time is essential to code organization and accountability.…It's not just about blaming someone;…it's about determining what changed, when and why.…Regardless of the size of the project, even if there's only one person working on a project, …
This course covers installation of Xdebug on Apache as well as working with the NetBeans IDE (integrated development environment). Jon then introduces native web browser developer tools for Firefox and Chrome, and demonstrates browser independent web debugging tools. Best practices for debugging and profiling web application failures and performance issues are also covered.
- Configuring PHP error reporting
- Logging errors to file
- Gracefully handling fatal errors
- Installing Xdebug
- Understanding the principles of remote debugging
- Remote debugging with NetBeans
- Extending your browser with Firebug, FirePHP, or ChromePHP