Why getters and setters are evil

Sep 9, 2003 00:10 · 68 words · 1 minute read

Allen Holub brings OO back to the front with Why getter and setter methods are evil

The getter/setter idiom is a commonplace feature in many Java programs. Most of these accessor methods, however, are unnecessary and can severely impact your systems’ maintainability. Using accessors violates the basic object-oriented (OO) principle of encapsulation, so you should avoid them. This article discusses getter/setter cons and offers an alternative design methodology.