A comment on using CFParam inside a CFFunction
This is a response/comment to Steve Goods post named: Using CFParam Inside a CFFunction. Its turned into a blog post because, well I suppose I am looking for a wider feedback on my thoughts.
When it comes to using <cfparam> in a <cffunction> I would never of even contemplated it up to a few weeks ago, mainly because of the framework I was using gave me other ways of checking of variables existence.But I've moved over to Framework One (FW/1) which uses the tag in its controllers for some of the demos and I've now adopted this in to my recent code.
This then got me thinking that I cannot find a solid case reason as to write
2{
3myVar.someKey = "0";
4}
5else if ( NOT isNumeric( myVar.somekey ) )
6{
7throw();
8}
when cfparam does that all in one go with basic type checking aswell.
You could wrap the if() logic in a function to be used but then aren't you just adding an extra layer to your code to do something CF already handles?
| Tweet |
| If you like what you see on the website and/or this post has helped you out in some way please consider donating to help keep me in beer vodka. The donations are made through Paypal, which accepts almost any credit card or eCheck. |