Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-05-23 13:39:13


"Edward Diener" <eddielee_at_[hidden]> writes:

>> If you are making designs that would normally have a lot of getters
>> and setters, it suggests that they may have an insufficient level of
>> abstraction. Of course, that isn't neccessarily the case -- but it
>> does seem to be the rule in my code. I personally don't have a need
>> for this facility and I don't think I want a library that would
>> encourage that style.
>
> I don't see what getters and setters have to do with levels of
> abstraction. Needless to say I see nothing wrong with the style
> that uses properties, but since you didn't say what bothers you
> about that style I can't answer for why you don't like it. Care to
> explain ?

When classes have a lot of getters and setters or, equivalently,
exposed properties that are just reflections of underlying data
members, they usually represent just a collection of exposed data
values rather than a higher level of abstraction.

I haven't read through this to see if I agree with any of the points
being made, but you can read an article on the subject here:

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

and a pretty comprehensive discussion here:

http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=70526

To the extent to which properties (which I *do* think have a place in
good software) are just syntactic sugar for getters/setters, the same
arguments apply.

You can of course make up your own mind about this stuff ;-)

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk