Re:Coding Skill and the Decline of Stagnation
by cunac on Friday January 13, 2012 @11:42PM
(#3463480)
one good reason would be because setters and getters are way easier to mock out than direct access to member variable
And we all want to have code tested , don't we ? :-)
Re:Coding Skill and the Decline of Stagnation
by dextorious on Saturday January 14, 2012 @07:11AM
(#3464088)
No, I most certainly don't.
Plus, no, often I can't afford a function invokation. Because it's yet another cache miss.
If all of those things don't matter (or you work on a large enough team that the benefits of abstraction are worth it), yes, add getters/setters everywhere. For the rest of us, we might have actual _reasons_ why we don't cargo-cult our code.