
Julio M. Merino Vidal wrote:
Hello,
[ I'm not sure this really belongs to this list (as opposed to some C+ + generic list), but as it is related to some comments I received a while ago from this list, I'm posting it here. ]
Back when I presented Boost.Process 0.1 past year, I used getters for all class members that had to be exposed to the library user.
However, some reviewers commented that it was "ugly" to provide getters that just returned a member's value. I tried to change most of those instances to constant members that could be queried directly, but I still have doubts whether that was the correct way to go.
Your doubts are well founded...
Here are my reasons supporting getters:
...snip...
- The getter is overall suppressed, thus removing a level of indirection.
- Err, what else?
Most of the work of converting getters to constant members was already done in the Subversion repository, but there still are some methods that were not converted. Before switching these, I'd like to reach a conclusion whether this is the way to go or not.
The standard library uses 'getters' to describe almost all class interfaces I can think of. So I'd go back the original approach. Jeff