Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 25 Jul 2011 15:27:28 -0500 From: Patrick May Newsgroups: comp.lang.java.programmer Subject: Re: A question about some long java code that has getters/setters References: <1672e2f1-a963-4fcf-b651-41b69432c9d7@p29g2000pre.googlegroups.com> Date: Mon, 25 Jul 2011 16:27:28 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:fbmRatZSdG52vL+6P7WF+yK1Tmk= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 16 X-Trace: sv3-Wzs1hO9I2vSEFXm1pYynLPg1wBL/IXhXylE+xCluOHh21x0pPZbpMHPw1NXocmpEcFmdXsmZY2h1Sep!PakMwN0pU9j9Y/zzXClgHc1JvWYZdJtKn1ZMte3TTDZBKWKOncIuzoXwMCqBACuooewaj3wF X-Complaints-To: www.supernews.com/docs/abuse.html X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1923 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6553 lewbloch writes: > It is standard practice to create accessors and mutators for class > attributes. There's nothing wrong with that. Actually, there is. It encourages a style of programming where objects have too much knowledge about each other. Encapsulation is important; objects should ask each other for services, not manipulate each others internals. With the exception of cases like DAOs, getters should be very rare and setters non-existent. Patrick ------------------------------------------------------------------------ http://www.softwarematters.org Large scale, mission-critical, distributed OO systems design and implementation. (C++, Java, Common Lisp, Jini, middleware, SOA)