Is your code ready for production ?
Thats it, you have just finished to develop your new impressive, amazing web application, and you are ready to show it at the rest of the world. You send your files to your production server, you goes to the welcome page to check if everything is ok, and you get this :
Access denied for user 'user'@'server' (using password: YES)
Ok ! You just forget to modify your config files for the server.
But wait ! WAIT ! Are you really display this kind of errors in a production use ? Seriously ?
Your users DON'T CARE if your application cannot access to the database, really !
They just want to see nice pages with nice ajax effets (wahou!)
When an error occurs, a good solution would be to display a message like :
Sorry,
our site isn't accessible for the moment,
please try later.
But NO errors !
So, before launching your website, here is some stress tests you can do, to see how your application will react :
- Shutdown MySQL (of course, the development one ...). You will be amazed to see how many page display strange errors :p
- Rename your database or delete it (of course, do a backup before ...)
- Rename some table (Do I really need to mention the backup ?). You can rename one and test, then rename an other, or few others at the same time, and every time : check your application.
- Rename/Move some files. What happens if the inclusion don't work ? (yes .. it's a bit extrem, but why not ?)
- Make some code mistakes voluntary (forgot a ";", "}", etc)
- Move/Rename the css folder, and the js folder. What you'll see is what could happen in a browser with js/css disabled.
- Move/Rename the images folder. What you'll see could happen for someone that have a slow bandwidth (56k for example).
And if your application use Ajax request, load a page and retry all the checks before, to see how your javascript code react. You can also shutdown the web server (Apache, Glassfish, IIS, ...) to see how your ajax handlers will responds.
If, with all the tests you made, the only information you receive is an nice page or a nice dialog with a human readable and simple message, your website is really ready for production use.
Of course, tracking errors is important. Don't forget to log all occured errors ! (in a file, by mail, it depends on how your sure about your work ;)).
I hope you enjoyed reading this article. I probably made some English mistakes and I apologize for that. I try to do my best (:
Feel free to add comments. I'll enjoy discuss about that with you :)