The variables scope of the CFC is there to be used for properties that
should be available between different method calls (one of the most
useful bits of OO). It's like the THIS scope only it's protected with
regards to the CFC instance. To make it thread safe, use CFLOCK.

As for the original question, which was:
---
My question is in regards to the differences between

newJob.name = form.name;
newJob.insertJob();

and

newJob.insertJob(name=form.name);
----

If you want to have the "name" variable available for more than one
method, set it as a property, but don't use the direct assignment
newJob.name = form.name, use a setter method newJob.setName(form.name)
which sets it in the VARIABLES scope. This gives you the opportunity
to check the data when set, before the insert method is called.

If you don't want the "name" variable to remain in the CFC between
method calls, pass it in as per newJob.insertJob(name=form.name).

On 2/17/06, Alan Rother <[EMAIL PROTECTED]> wrote:
> I'm sorry, are you asking if you should use the variables scope in the CFC
> itself?
>
> If so, I don't recommend it. using variables.  anything makes that variable
> available to all of the other methods in the cfc and basically trashes the
> thread safeness of the cfc, that is if you are using the cfc in a persistent
> scope. If you are instantiating the cfc evertime you use it, then it's ok,
> but under load it can really start to take a performance hit if you are
> invoking on every hit to the page.

--
CFAJAX docs and other useful articles:
http://jr-holmes.coldfusionjournal.com/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232656
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to