But by referring to the form directly, your CFC already knows about the
outside.  I am just learning about CFCs and OO myself, but I thought the
point of them was to make them independent of  what was going on the
outside, and to just pass them the information that they needed regardless
of the source.  Meaning, that perhaps your CFC requires another method that
is getSource so that you could pass it a var that sets the source to a
struct that contains form data, or a struct that contains data not from a
form, or to use a query result from the DB.
Rob

On Wed, Oct 22, 2008 at 11:14 AM, Rick Faircloth
<[EMAIL PROTECTED]>wrote:

> Thanks for the feedback, Mike.
>
>  > Even though it works, it is not a normal practice for the guts of a
>  > component to know what is going on outside.
>
> What's the difference, ultimately, in referring to the form variables
> in <cfset myObj.update_product(form, product_id)> and just referring
> to them directly in the query?
>
> Either way, they're still just methods of "informing" the method of
> the data "on the outside", right???
>
> It just seems like two different ways of doing the same thing...
>
> Rick
>
> Dawson, Michael wrote:
> > Even though it works, it is not a normal practice for the guts of a
> > component to know what is going on outside.
> >
> > Alghouth it's a reach, it is possible that your update_product method
> > could accept URL variables, rather than form variables.  If this were
> > true, then you would have to modify your method.
> >
> > However, if you called the update_product method, and passed in the form
> > scope, you would not have to change your method.
> >
> > For example:
> >
> > <cfset myObj.update_product(form, product_id)>
> >
> > <cffunction name="update_product" ...>
> >
> >     <cfargument name="updateStruct" ...>
> >     <cfargument name="product_id" ...>
> >
> > </cffunction>
> >
> > Could easily be changed to:
> >
> > <cfset myObj.update_product(url, product_id)>
> >
> > without having to touch your update_product method.
> >
> > Like I said, even though it works, most people try to avoid referencing
> > external scopes outside the component.  The worst-case scenario would be
> > that you may be put on someone's do-not-hire list because they are
> > sticklers for things such as this.  ;^)
> >
> > Mike
> >
> > -----Original Message-----
> > From: Rick Faircloth [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, October 22, 2008 9:10 AM
> > To: cf-talk
> > Subject: How can this CFC be improved?
> >
> > Hi, all... still trying to get a handle on using CFC's.
> >
> > Here's an update method I wrote and I'd like to know what can be changed
> > to make it better.  Such as, why not use the form scope in the query?
> > And, why not just use the application scope for the dsn, instead of
> > converting it to the variables scope?
> >
> > If components have access to the url, form, session, and application
> > scopes, etc., why not use them in the component?
> > What's the benefit of converting them?
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314230
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to