Saturday, February 12, 2011

More on getters and setters - Don't do it

"It's a 25-year-old principle of object-oriented (OO) design that you shouldn't expose an object's implementation to any other classes in the program. The program is unnecessarily difficult to maintain when you expose implementation, primarily because changing an object that exposes its implementation mandates changes to all the classes that use the object." -- By Allen Holub, JavaWorld.com, 01/02/04

To that, don't use setters and getters exclusively for all POJO beans.

http://www.javaworld.com/javaworld/jw-01-2004/jw-0102-toolbox.html

No comments:

Post a Comment