Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #6594
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.glorb.com!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 | Tue, 26 Jul 2011 15:35:04 -0500 |
| Date | Tue, 26 Jul 2011 13:34:56 -0700 |
| From | Patricia Shanahan <pats@acm.org> |
| 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 | <d94f5902-8b2e-484f-8095-9ce034e916d4@t8g2000prm.googlegroups.com> <1672e2f1-a963-4fcf-b651-41b69432c9d7@p29g2000pre.googlegroups.com> <m21uxehzrj.fsf@softwarematters.org> <j0kvh1$1eq$1@dont-email.me> <Getters-and-Setters-20110726023724@ram.dialup.fu-berlin.de> <hq5s27hjit5limeqt7eef01l8r9539p0ff@4ax.com> <setter-20110726111404@ram.dialup.fu-berlin.de> <vcvt27l0b8c9vqdobhfqhudivq8i8mesjl@4ax.com> <setter-20110726201927@ram.dialup.fu-berlin.de> <at2u2712qceiq70etcqa9ed4jjc8dftgvd@4ax.com> <setter-20110726211038@ram.dialup.fu-berlin.de> |
| In-Reply-To | <setter-20110726211038@ram.dialup.fu-berlin.de> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Message-ID | <woOdnZ78R4FlubLTnZ2dnUVZ_vudnZ2d@earthlink.com> (permalink) |
| Lines | 45 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 70.230.200.239 |
| X-Trace | sv3-hM47SAMDQ0ACIeGY+Ef4VKg8LQilf9Rfp167g5idIVOsKs4P39yJsLI98MIMPlqZGZkpvRIKbGyfrAG!l4ExIYkGxoj9Z51RUAxcosHdLeL/ocqqnwC7caq3t9GxweRu34VihnBRkYkSLjP4OJV7UJiFrk3m!fkneJ93+GL4paoG4TrexYu+8i7gCk5TvQXcCfocJrvPNn1Y= |
| 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 | 3444 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6594 |
Show key headers only | View raw
On 7/26/2011 12:15 PM, Stefan Ram wrote: > Gene Wirchenko<genew@ocis.net> writes: >>> Since I do not know whether your methods > > (insert »according to their contract«, here) > >>> set the value of an >>> instance variable, I do not know, whether they are »setters« >>> in the sense of my definition. I would need to be able to >>> read their contract (documentation) to learn about this. >> Read my example contract above. It does not mention an instance >> variable, but any reasonable implementation that I am likely to do >> would use one. > > Ok, then - to me - it is not a »setter«. > >> They set something. Whether it is an instance variable or not is >> irrelevant to their use. > > That is even another reason not to make references to instance > variables in the contract of a method. > > A »Setter« to me is a method with a contract like: > > »... sets the private field "alpha" to the argument value.« > > Your method does not set a »field« but a »property« of the object. > Its contract does not allow a party to deduce with > certainity something about the private fields of the object. > Therefore, it does not break encapsulation. > We have two possible definitions of "setter", with corresponding definitions for "getter". 1. A method whose contract specifies setting an instance variable. 2. A method whose contract specifies setting a logical property of the object. To me, it seems wasteful to use an nice, short, simple term for something that should *never* exist, when it could equally well be used for something that is actually useful, so I prefer the second definition. Patricia
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
A question about some long java code that has getters/setters Chad <cdalten@gmail.com> - 2011-07-22 16:12 -0700
Re: A question about some long java code that has getters/setters Arne Vajhøj <arne@vajhoej.dk> - 2011-07-22 19:28 -0400
Re: A question about some long java code that has getters/setters Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-07-22 23:31 +0000
Re: A question about some long java code that has getters/setters markspace <-@.> - 2011-07-22 16:51 -0700
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-23 09:02 -0700
Re: A question about some long java code that has getters/setters blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-23 17:41 +0000
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-23 11:42 -0700
Re: A question about some long java code that has getters/setters Arne Vajhøj <arne@vajhoej.dk> - 2011-07-23 17:59 -0400
Re: A question about some long java code that has getters/setters Steve Sobol <sjsobol@JustThe.net> - 2011-07-23 23:39 -0700
Re: A question about some long java code that has getters/setters blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-25 19:44 +0000
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-26 09:03 -0700
Re: A question about some long java code that has getters/setters Arne Vajhøj <arne@vajhoej.dk> - 2011-07-23 19:26 -0400
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-26 09:00 -0700
Re: A question about some long java code that has getters/setters Patrick May <patrick@softwarematters.org> - 2011-07-25 16:27 -0400
Re: A question about some long java code that has getters/setters markspace <-@.> - 2011-07-25 15:14 -0700
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-25 15:56 -0700
Re: A question about some long java code that has getters/setters Patricia Shanahan <pats@acm.org> - 2011-07-25 17:00 -0700
Re: A question about some long java code that has getters/setters Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-25 21:17 -0400
Re: A question about some long java code that has getters/setters markspace <-@.> - 2011-07-25 16:50 -0700
Re: A question about some long java code that has getters/setters Gene Wirchenko <genew@ocis.net> - 2011-07-25 18:30 -0700
Re: A question about some long java code that has getters/setters Patricia Shanahan <pats@acm.org> - 2011-07-25 18:41 -0700
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-26 09:05 -0700
Re: A question about some long java code that has getters/setters Gene Wirchenko <genew@ocis.net> - 2011-07-26 10:48 -0700
Re: A question about some long java code that has getters/setters Gene Wirchenko <genew@ocis.net> - 2011-07-26 11:56 -0700
Re: A question about some long java code that has getters/setters Patricia Shanahan <pats@acm.org> - 2011-07-26 13:34 -0700
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-26 14:21 -0700
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-26 14:20 -0700
Re: A question about some long java code that has getters/setters Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-25 21:35 -0400
Re: A question about some long java code that has getters/setters Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-07-26 06:59 -0300
Re: A question about some long java code that has getters/setters Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2011-07-26 12:19 +0300
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-26 09:08 -0700
Re: A question about some long java code that has getters/setters Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2011-07-27 15:56 +0300
Re: A question about some long java code that has getters/setters lewbloch <lewbloch@gmail.com> - 2011-07-27 14:14 -0700
csiph-web