Why code by hand when computers can do it for you? :)

http://rooibos.maestropublishing.com/

It seems to be standard to be using the full method sets.  I believe
ColdSpring searches your CFCs for getters and setters. So if you wanted to
use ColdSpring (and probably some other frameworks), you should either have
those getters/setters or have the attributes able to be passed in the
constructor.

Jonathon


-----Original Message-----
From: Rob O'Brien [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 14, 2007 1:51 PM
To: CF-Talk
Subject: OO style - dynamic set & get methods

So, I'm just starting to go into OO-style CF development and I have a quick
theory question... Mind you, this is brand new to me, so be gentle.

When setting up my Location Bean, I started to go through each of the
individual variables and created a get() and set() method for each of them.
I got about halfway through and decided that I was tired of creating
repetitive functions. I thought to myself, why can't I just create simple,
dynamic get() and set() functions to handle all of these variables
dynamically?

Rather than setName(value), why not setVar("Name",value)?

Since these methods are inherently dumb (nothing but a cfset and a cfreturn
as I've seen implemented), why does it matter that I have an individual
method for each? Validation would come in an additional business layer
anyway. 

I guess I'm looking for pros/cons. This seems like a more dynamic, elegant
way to set/get, but I'd like to know where the pitfalls are.

Thanks! 
Rob




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281180
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