> ... load all the data into some instance variable ...
What is a true instance variable in a CFC?
<cfcomponent>
<cfset myVar="Hello" />
Is the above equivalent to
public class SomeVars{
public String myVar="Hello";
}
How are contructors implemented in CFC's?
Is there a default constructor for a CFC?
Do CFC's have public/private/protected, static/final instance
variables?
Can somebody explain the above or point to any docs?
Thanks
Joe Eugene
-------Original Message-------
From: Matthew Walker <[EMAIL PROTECTED]>
Sent: 03/30/03 02:52 PM
To: CF-Talk <[EMAIL PROTECTED]>
Subject: Re: CFCs - get'ers Vs. return object
>
> Thanks Sean. You know the biggest problem I and perhaps others have with
CFCs is not so much writing code that uses them, but writing code that
uses
them appropriately, i.e. in ways that don't dilute their value while still
providing efficient code. So it's interesting to see recommendations like
this.
----- Original Message -----
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, March 31, 2003 5:42 AM
Subject: Re: CFCs - get'ers Vs. return object
> On Saturday, Mar 29, 2003, at 16:13 US/Pacific, Matthew Walker wrote:
> > I am only dabbling in CFCs but it seems sensible to me to retrieve a
> > structure of related information using one getter, then just accessing
> > that.
> > But maybe I just don't "get" CFCs. Perhaps it's up to the CFC to cache
> > that
> > info so that endless database requests aren't required. For example,
> > the
> > first getSomething() could query the database for more than just the
> > one
> > requested field, and store the whole lot in a cache. Any following
> > getSomethingElse() could grab the data from that cache.
>
> Yes, that's a pretty good way to implement it (so I'd say that you do,
> indeed, "get" CFCs). In fact, you could have a method that gets all the
> data, declared access="private", and then in each of your
> 'getSomething()' methods, you test whether the data is already in cache
> and, if not, call the private 'getAllData()' method to load it:
>
> <cfcomponent>
> <cfset isCached = false>
> <cffunction name="getAllData" access="private">
> ... load all the data into some instance variable ...
> <cfset isCached = true>
> </cffunction>
> <cffunction name="getSomething">
> <cfif not isCached>
> <cfset getAllData(...)>
> </cfif>
> <cfreturn myCache.something>
> </cffunction>
> </cfcomponent>
>
> Sean A Corfield -- <a target=_blank
href="http://www.corfield.org/blog/">http://www.corfield.org/blog/</a>
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4