Thanks Brian, I didn't realize there was a variables.instance structure =) Here is the lowdown I got from everyone's comments:
If I was working either with a team, using coldspring, or working on a large project or public facing components, I would probably generate individual getters / setters for each internal value I would want to work with. As many have mentioned, this makes the component self documenting and adds type checking. The project I am working on now simply requires that I be able to use this for several different sub-companies down the road, and the only one that will touch this code (at least in the foreseeable future) is me. I have an init method that accepts a structure to setup all datasources and other per-company settings, so I think my generic getter / setter should work fine in this instance. Thanks to everyone for their reply's, I always learn something new. =) Chris Peterson Gainey IT Adobe Certified Advanced Coldfusion Developer -----Original Message----- From: Brian Kotek Sent: Monday, July 09, 2007 10:27 PM To: CF-Talk Subject: Re: Init method and getters / setters in cfc It's so trivial to generate the code for getters and setters that I don't really see the point in having generic getters and setters like this. As Ben says, you lose the API for your component. You have no type checking (if that's your thing). You lose the ability to seamlessly change the getter or setter later if the need arises. And if you want to use ColdSpring to inject dependencies, you're either out of luck, or almost as bad, you have a mixed API where some properties have their own setters and others use the generic setter. Also, an aside, there's no reason to use Evaluate() here. Just do <cfreturn variables.instance[arguments.name] />. Regards, Brian ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion MX7 by AdobeĀ® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283376 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4