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.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 25 Jul 2011 19:00:49 -0500 Date: Mon, 25 Jul 2011 17:00:43 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 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> <7241d106-caca-4137-a060-ecd2d5fa2eb8@u12g2000prc.googlegroups.com> In-Reply-To: <7241d106-caca-4137-a060-ecd2d5fa2eb8@u12g2000prc.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 20 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.200.239 X-Trace: sv3-KrKgoSyfAm4yGvlKOIZC60Moq3fS16cWwwLFGdftXzGEqKdFu07EqNnmAgm8UYZn3O83t4CMIMLz599!TMPJxasFG7YX2Hf1kaOvOyE11lpPw9VSIEdPYC9g8qblVUbjFJeY/LU4X4XG1k6sVOnmQv5tVX1U!ZdD5kAcyRE3PbBv8RXsI3ITzzU4K7Y9dbpzvlcLnrDoUzCM= 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: 2277 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6557 On 7/25/2011 3:56 PM, lewbloch wrote: > On Jul 25, 1:27 pm, Patrick May wrote: >> 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. > > You don't create them for hidden members! Yeesh. I've been doing some Java tutoring. I've seen coursework assignments that *required* the student to create a getter and setter for every field. :-( Patricia