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.
Matthew Walker Electric Sheep Web http://www.electricsheep.co.nz/ ----- Original Message ----- From: "Thomas Chiverton" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, March 27, 2003 12:01 AM Subject: CFCs - get'ers Vs. return object > I'm just starting to write my first CFC in anger, as it were, and was curious > about what others were doing. > Are people writing a number of of getX,getY,getName,get.... methods, each > returning a string/numer and then using > <cfobject component="com.locavista.location" > name="objLocation"> > <cfoutput>#objLocation.getName(156537)#</cfoutput> > OR writing a single get that returns a query or custom object, and then using > <cfinvoke component="com.locavista.location" > method="get" > iLocId="156537" > returnVariable="objLocation" > > <cfoutput>#objLocation.description#</cfoutput> > > Obviously, no difference in output, but writing lots of get'ers is time > consuming, though provides better abstraction from the datastore. > Also, each getX will make a database query, so outputting a list of the > objects will be much slower using the first method than the second, as I see > it. > > So I'm plumbing for doing it the 2nd way - is there any sort of consensous on > this ? > -- > Tom C > "Land of the free, home of the brave... you have to be brave to live there and > enjoy the freedoms" > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4