Manuel Lemos posted a very interesting article on defensive programming techniques. Things goes when PHPClasses newsletter faced some technical problems in delivery, but thanks to defensive programming “no harm was done. It only caused a delay in the delivery of the newsletters that were left in the queue for several days”. An interesting experience I can say because there are unexpected things that might happen to your site, and using some best practice programming techniques you can prevent the worst from happening. Manuel recommends to :

  1. Handle unexpected conditions
  2. Process external systems data properly
  3. Test your code
  4. Monitor your site errors and act upon them
  5. Do not disclose errors to the users
  6. Damage control
  7. Backup
  8. Do what you can as you can never get defensive enough