The best way to start error-proofing your code is by following these steps:
1. Identify every incoming piece of data, and document it and it's datatype
2. Identify any possible conflict issue between different scopes of data either incoming or created by the application.
3. Then document each section of your app, with the above information, so you can tackle your app 1 step at a time.
Now that you have the documentation, now comes the setup.
First of all, in my personal style and attempt to prevent scope creep, I came up with my own variable naming scope.
For any application, at the top of the page i create a list of variables that are going to be used within the app, as well as incoming data.
!-- global variables --
cfparam name="local_firstname" default=""
cfparam name="local_lastname" default=""
cfparam name="local_price" default="0.00" scale="2"
Then i move all cfparams through out the application, to the top of the app, for easier sorting and eliminating duplicates.
Now then comes the population from wherever your datasource is: url, form, query, cgi, file, client, cookie or local.
Then you put a cfoutput surrounding the whole form, then you have created an error proof form.
Let me explain.
By having a default values for every form element, you make sure that the form can be used either for an edit content or add content piece. Which really speeds up the process of creating forms.
Now all of this is part of my philosophy of preventing errors from occuring in the first place, rather than trying to catch for them.
I'll walk thru a section of an app, and try to identify places it can fail, and do what i can to prevent it.
More to come...