I understand what you are saying and I am not trying to knock your
programming style.
The reason that I prefer to have all the variables cfparamed at the start is
that there are no exceptions. It doesn't matter if it is a text field,
radio button or check box. You can treat them all to the same style of
coding.
I wouldn't like to say <cfif x eq "1"> sometimes and then say <cfif
isDefined("form.myRadionButton"> other times.
It is more about the consistency.
I also find that, even if I am not using fusebox or whatever MVC I still
copy all my form and url variables to the attributes scope. This is also
for consistency and for flexibility
Cheers,
Simon
On 08/12/06, Andrew Scott <[EMAIL PROTECTED]> wrote:
>
> Yes,
>
>
>
> I am well aware of your explanation, but let's look at something else for
> a minute.
>
>
>
> Forms?
>
>
>
> Now although cfparam can be used to handle radio buttons, you might need
> to do something like this
>
>
>
> <cfif IsDefined("form.radioButon")>
>
> … then do sql code
>
> </cfif>
>
>
>
> But if I do this
>
>
>
> <cfparam name="Form.RadioButton" default="Not Defined" />
>
>
>
> I still have to do
>
>
>
> <cfif Form.RadioButton neq "Not Defined">
>
> …. Then do sql code
>
> </cfif>
>
>
>
> And I am sorry, but I find the IsDefined() neater in that case:-)
>
> There are also other cases where I have used it too, but mainly with the
> form and URL scopes as far as variables go they are always declared with the
> var scope or variable scope.
>
>
>
> And yes I use MVC, its neater and cleaner in page design.
>
>
>
> Andrew Scott
> Senior Coldfusion Developer
> Aegeon Pty. Ltd.
> www.aegeon.com.au
> Phone: +613 8676 4223
> Mobile: 0404 998 273
> ------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Simon Haddon
> *Sent:* Friday, 8 December 2006 12:31 PM
> *To:* [email protected]
> *Subject:* [cfaussie] Re: Talking of evaluate()
>
>
>
> Hi,
>
> I think that your statement about using cfparam sums it up well. It is
> all about code design. If all you variables are declared and initialised at
> the beginning of a template, custom tag, function or cfc then it improves
> readability and maintainability. It helps to ensure that you have thought
> about each variable you are using and also, I find, that it reduces reuse of
> the same variable for cross purposes. Imagine if you have some code that
> uses isDefined and you are relying in the fact a variable exists to take
> some action. Then later some else comes along and uses the same variable
> name in another template. Woops. Code broken. If you "parametrise" and
> initialise your variables at the start of your template it is easier to read
> and less chance of conflict with other code. I would much rather "know"
> that a variable exists and see what values it contains than hope it exists.
>
> It also cuts down you coding as you only have to say
>
> <cfif x eq "somevalue">
> ....
> </cfif>
>
> rather than
>
> <cfif isDefined("x" and x eq "somevalue">
> ....
> </cfif>
>
>
> Anyway. That is a very quick reason and something that I could rant on
> about for ages but hopefully gives a little idea about why I don't like
> isDefined.
>
> I have not come across a reason to use isDefined accept in an error
> handler.
>
> >
>
--
Cheers
Simon Haddon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---