Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23614
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: DI/wiring |
| Date | Wed, 24 Apr 2013 09:44:15 +0200 |
| Organization | A noiseless patient Spider |
| Lines | 77 |
| Message-ID | <kl82ao$afu$1@dont-email.me> (permalink) |
| References | <DI-wiring-20130418174944@ram.dialup.fu-berlin.de> <MeVbt.370900$Nq4.247520@newsfe21.iad> <conventions-20130424061354@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Wed, 24 Apr 2013 07:41:12 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="f701c873d1c9639558344ff9364b0d50"; logging-data="10750"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ioYyVK3vTM7L97s+WmzV+" |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 |
| In-Reply-To | <conventions-20130424061354@ram.dialup.fu-berlin.de> |
| Cancel-Lock | sha1:WenWTOLrs7FsWD4OsbCRYG7dtCg= |
| Xref | csiph.com comp.lang.java.programmer:23614 |
Show key headers only | View raw
On 24/04/2013 06:34, Stefan Ram allegedly wrote:
> Daniel Pitts <newsgroup.nospam@virtualinfinity.net> writes:
>> Why aren't those simply setters? Must you go against all convention in
>> every possible way?
>
> I just had to remember that remark, when I read a method
> name of mine that made me smile myself, it was the name
>
> acceptReportAcceptor
>
> . Here is some more context:
>
> public void acceptReportAcceptor( final ReportAcceptor reportAcceptor )
> { this.reportAcceptor = reportAcceptor; }
>
> . But now, honestly, when one sees a hungry man, and gives
> him some bread and says:
>
> »Sir, please accept this bread!«
>
> this sound fine to me, while
>
> »Sir, please set this bread!«
>
> sounds strange. In
>
> object.acceptNumber( 2 )
>
> I tell the object to accept the number, but what is
>
> object.setNumber( 2 )
>
> supposed to mean? How can the object set the number 2?
> This makes no sense!
>
> But I am not a native English speaker. May be I am missing
> something here.
>
> Imagine I would have called the reportAcceptor
> »reportSetter«. This would have made no sense to me! This
> object is supposed to accept a report, not to set a report!
> The report is already »set« by the caller, the callee is
> just asked to kindly consider accepting it!
>
>> Why aren't those simply setters?
>
> Actually I do not know the definition of »setter« that you
> take as basis for your question. When do you call something
> a setter?
>
You give that bread to the hungry man to be his property; yet bread is
not a property of a hungry man (except perhaps a boolean one). Or again
without the wordplay: you give that bread to the hungry man to be his
possession; yet bread is not a quality of a hungry man. The closest
equivalent in engineering terms is that you give it to him for
/processing/, to do something with, to consume. If he's hungry enough,
he'll eat it; if he's gluten sensitive, he won't; if he's a Goldman
Sachs banker, he'll short the bread and long the Yen. In either case,
"bread" is not a quality of any man, hungry or not. Hungriness, however,
is. And while on an object whose purpose would be to re-form the
Austro-Hungarian empire, you might define a method call "acceptHungary",
you wouldn't call a method "acceptHungry" if you wanted to determine
whether not that object was hungry or not, would you? Or, to put it
differently, imagine you had your own Goldman-Sachs banker to play with,
and could resist the urge to arrange his timely and painful demise (it's
a stretch, but bear with me). There might be numerous qualities of his
you might want to alter: his hairdo, his clothing, his level of naked
short selling... In each case, you'd use a setter: "setHairdo",
"setClothing", "setLevelOfNakedShortSelling". It would be totally
pointless to say, for instance, "acceptLevelOfShortSelling". Why, he'd
probably double down on whatever you specify on his own anyway!
HTH,
--
DF.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: DI/wiring Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-04-18 09:32 -0700
Re: DI/wiring Lew <lewbloch@gmail.com> - 2013-04-23 23:32 -0700
Re: DI/wiring Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-04-24 09:44 +0200
Re: DI/wiring Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-04-24 09:19 -0300
Re: DI/wiring Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-04-24 08:40 -0700
Re: DI/wiring Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-04-24 13:05 -0300
Re: DI/wiring Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-04-24 21:14 +0200
Re: DI/wiring Joerg Meier <joergmmeier@arcor.de> - 2013-04-24 20:13 +0200
Re: DI/wiring markspace <markspace@nospam.nospam> - 2013-04-24 14:22 -0700
csiph-web