Error checking - When is too much.
Posted: Tue Jan 21, 2003 3:51 pm
This is more a question about theory than an actual coding problem. I've been taking error checking very serious of late and am getting better and better at. But it seems that you could error check just anything you do and my code is starting to look more like one big error check than an application. I don't mind writing the code, it's strain that all this overhead is adding the server that I'm worried about.
For instance. I'm writing a template class that receives a filename, checks that there is in fact a filename passed, checks that the file exists, reads the file, checks that it has in fact read something in and is not just empty, implodes it to string and sets the string to a class property. Then when you want to modify the template, it checks that you have a template already set, checks to see if you've actually given any changes, and then makes the changes. Then when you want to display, it checks to see if you have a template set, then displays the template, and tells the calling script that it's succeeded or failed.
Is this going overboard. Should we be striving to have PHP applications that never show those nasty default PHP errors, and instead show nicely formatted error that were prewritten by guess who....ME.
What do you think? Smart Programmer or Eagerly Over Zealous.
For instance. I'm writing a template class that receives a filename, checks that there is in fact a filename passed, checks that the file exists, reads the file, checks that it has in fact read something in and is not just empty, implodes it to string and sets the string to a class property. Then when you want to modify the template, it checks that you have a template already set, checks to see if you've actually given any changes, and then makes the changes. Then when you want to display, it checks to see if you have a template set, then displays the template, and tells the calling script that it's succeeded or failed.
Is this going overboard. Should we be striving to have PHP applications that never show those nasty default PHP errors, and instead show nicely formatted error that were prewritten by guess who....ME.
What do you think? Smart Programmer or Eagerly Over Zealous.