Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
droopcat #1
When to use getters/setters with CFC's
I'm a bit confused as to when it is good practice to use getter/setter methods
in CFC's and when to use the THIS scope to make the properties publicly
available. There are some articles around, but some are creating getter/setter
methods for each property while others strongly discourage using getter/setter
methods for single properties and even others are just creating all properties
in the THIS scope so there is no need for getter/setter methods. Does anyone
know of a comprehensive article that explains this very clearly (in relation to
CFC's)
droopcat Guest
-
Nesting functions in CFC's
I'm trying to move the contents of my Application.cfm and OnRequestEnd.cfm to a new Application.cfc. Everything works, except for the UDF's. I need... -
Pathing with CFC's
I'm reading Ben Forta's (EXCELLENT) book, but he (as well as every site I've Google'd so far) does not give information about the question I'm going... -
Calling Cfc's
I am developing two applications on the same server that will have a lot of overlapping functionality. Hence, I would like to share cfcs between the... -
getters and setters
I am new to CFCs and I think I am missing the point of getters and setters A lot of the text says that when writing a cfc we should write getter... -
[PHP-DEV] static property setters
Andi, Zeev, Mind if I add #define ZEND_STATIC_PUBLIC_PROPERTY(class_ptr, name, value) \ { \ char *_name = (name); -
mpwoodward *TMM* #2
Re: When to use getters/setters with CFC's
droopcat wrote:
I'm sure you'll get multiple opinions on this, but here's my take. In> I'm a bit confused as to when it is good practice to use getter/setter methods
> in CFC's and when to use the THIS scope to make the properties publicly
> available. There are some articles around, but some are creating getter/setter
> methods for each property while others strongly discourage using getter/setter
> methods for single properties and even others are just creating all properties
> in the THIS scope so there is no need for getter/setter methods. Does anyone
> know of a comprehensive article that explains this very clearly (in relation to
> CFC's)
>
general I don't use the THIS scope in my CFCs. The THIS scope makes
everything publicly-available directly to the world outside the CFC. If
you use the variables scope and getters/setters, then you have more
control over things and can (if you need to) add validation, permission
checking, and all sorts of other functionality to work with your getters
and setters. That way the requests to get and set your CFC attributes
can be more controlled.
Matt
--
Matt Woodward
Team Macromedia - ColdFusion
mpwoodward *TMM* Guest



Reply With Quote

