<SNIP>
In the instance example, you'd use CreateObject and call init(userid)
once. Then you'd call AddNewsLetter(newsletterid) 3 times instead.
</SNIP>

I am going to have to look into this... I am venturing into the
unkown. I have read up on CreateObject, but is was all abstract at the
time. I will also have to look into init() and all the rest.

It seems like the more I learn the more I need to learn. I know it
will all pay off once it makes sense and I am writing code only once.

Thanks,
Aaron

On 2/13/06, James Holmes <[EMAIL PROTECTED]> wrote:
> I can answer this bit  - yes, a similar situation exists in CF. The
> CFC is like a class, which you can instantiate with CreateObject() or
> CFOBJECT.
>
> If code uses CFINVOKE, specifying a path to the CFC file, it actually
> instantiates the CFC first (in the background) and then runs the
> method. This is why an instance is a good idea - you only get the
> instantiation hit once. You then also have the ability to have an
> instance that remembers things between method calls (by putting them
> in the VARIABLES scope), so in general you can create code that
> performs better.
>
> In your example, you might have a method that adds a newsletter for a
> user. You might have 3 newsleters to add; in the direct CFINVOKE
> example, you'd call something like AddNewsLetter(userid, newsletterid)
> 3 times, meaning that the component gets created three times. In the
> instance example, you'd use CreateObject and call init(userid) once.
> Then you'd call AddNewsLetter(newsletterid) 3 times instead.
>
> On 2/14/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> [snip]
> > Another thing: In this scenario, should I instantiate an object of the
> > newsmanager component? I have been reading in my Java book that there
> > is a difference between a method class and a method instance. A method
> > class, as you probably know, is not an instance. Does this apply to
> > CFC's in CFML?
>
> --
> CFAJAX docs and other useful articles:
> http://jr-holmes.coldfusionjournal.com/
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232179
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to