Just catching up on some old threads because I've been crazy busy lately...

On Mon, Feb 15, 2010 at 6:44 AM, John Whish <[email protected]> wrote:
> Would you create and use a private getter and setter for mutating
> "foo"?

No. I avoid getters/setters as much as possible since they essentially
break encapsulation and I never use private getters/setters at all - I
see no point.

http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html

Yes, there are times where you need to just 'get' data in order to
merge objects into procedural code (such as views) - but there are
other ways to do that too - so if you can avoid getters and setters,
your code will do less of this:

something = obj.getFoo() + obj.getBar();
obj.setFooBar( something );

That's horribly non-OO since you're performing the operation outside
the object rather than inside it.

*dons flame-retardant suit*
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

-- 
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en.

Reply via email to