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 20:41:24 -0500 Date: Mon, 25 Jul 2011 18:41:22 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 32 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.200.239 X-Trace: sv3-XIz4RSSbAokqEr13UkW6Pa8fyvkoWstjyCYZBbpxB+X4rI5hm5FdYkko56h1ktienpAeJo+74+vnMCd!OhyHtQval3lCxL+LCzvFjCgHw+InezYAQdA1gW3P2VrQIvOkKBVEWbJc//lCPdftTed0C/PYGhPF!b0uWMTJd9qa5afOwHaYiMT6EWxosNCJYLtqdON8EXrn9EDw= 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: 2417 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6562 On 7/25/2011 6:30 PM, Gene Wirchenko wrote: ... > Getters: yes. Setters: maybe. > > What is wrong with something like: > > FilePrinter r=new FilePrinter(); > > // General Options > r.SetPrinter("\\Boojum"); > r.SetCopies(1); > r.SetDoubleSided(true); > > r.SetFilename("c:\somedir\fileone"); > r.Print(); > > r.SetFilename("c:\somedir\filetwo"); > r.Print(); > > r.SetFilename("c:\somedir\filethree"); > r.SetCopies(5); > r.Print(); In this sort of situation I would always have the corresponding getters. In general, if an object needs to set a knob it should be able to see the current setting, for a couple of purposes: 1. Logging the settings it controls. 2. Being able to temporarily change settings and put back the old value. Patricia