Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #6596
| From | lewbloch <lewbloch@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: A question about some long java code that has getters/setters |
| Date | 2011-07-26 14:21 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <7f9a9984-71dd-4773-a74b-26b7d87c2409@h18g2000yqk.googlegroups.com> (permalink) |
| References | (7 earlier) <vcvt27l0b8c9vqdobhfqhudivq8i8mesjl@4ax.com> <setter-20110726201927@ram.dialup.fu-berlin.de> <at2u2712qceiq70etcqa9ed4jjc8dftgvd@4ax.com> <setter-20110726211038@ram.dialup.fu-berlin.de> <woOdnZ78R4FlubLTnZ2dnUVZ_vudnZ2d@earthlink.com> |
On Jul 26, 1:34 pm, Patricia Shanahan <p...@acm.org> wrote: > On 7/26/2011 12:15 PM, Stefan Ram wrote: > > > > > > > > > > > Gene Wirchenko<ge...@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. +1 -- Lew
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