8 Jul
2013
8 Jul
'13
4:31 a.m.
Personally, I always consider properties with getters/setters an anti-pattern for OOP languages like C++. Class interfaces should include only those methods that describe logically valid actions one might take on instances of the class. The idea of properties might sometimes be appropriate. But often times, programs will see a hammer and treat everything they see after it as nails. It becomes easy to add a few more getters and setters for "the rest" of the implementation details and you lose proper encapsulation. Usually when I find a class with lots of get/set methods I find a class with very little thought used when that class was designed.