Skip to main content


Showing posts from April, 2011

Getters and Setters are Evil

Update: There is a new version of this post.I've been programming with OO languages since I was seventeen yet in the last week I've had what is without doubt one of the biggest learning experiences since I've started.Numerous developers that I've worked with claimed that we aren't doing OO properly. By we I mean software developers as a whole. Their argument being having all your code defined in classes does not mean you are obeying OO principles. By this they are often referring to the "Tell Don't Ask" principle. One particular individual at Codeweavers introduced me to idea that getters and setters are evil. While not true at face value, this statement is to get you thinking about what you expose to the outside world. Consider one of the founding pillars of OO programming; encapsulation.Encapsulation states that an objects internal state should be just that, internal. If we want a object to do something we shoul…