Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: DI/wiring Date: Wed, 24 Apr 2013 21:14:48 +0200 Organization: A noiseless patient Spider Lines: 42 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 24 Apr 2013 19:11:42 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="f701c873d1c9639558344ff9364b0d50"; logging-data="32691"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19lWZAHdift1/nCuFMjGpPM" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 In-Reply-To: Cancel-Lock: sha1:5VF+VTtbZfYjuS/SK25vI1jMTVI= Xref: csiph.com comp.lang.java.programmer:23630 On 24/04/2013 20:41, Stefan Ram allegedly wrote: > ram@zedat.fu-berlin.de (Stefan Ram) writes: >> Thanks for your helpful answer! I might still continue to >> use »accept« sometimes, but I see your point. > > It might have to do with the following aspect: > > The contract of the object O says: > > »Before the other methods of O can be > used, the method > > acceptRunnable( java.lang.Runnable ) > > has to be called once with an object > implementing java.lang.Runnable.« > > (Similar contracts apply often to the > classes I write in such cases.) > > Nowhere does the contract say that a > »property Runnable« exists or is set. > > A perfectly fine implementation of > »acceptRunnable« might be: > > public void acceptRunnable( final java.lang.Runnable runnable ) > {} > > The client cannot observer what the object actually does > with the runnable object. Therefore, »setRunnable« might not > be an appropriate name for such a method. > But Shirley, the object's contract specifies what it does with the Runnable and when it does it, does it not? Also, what is the contract of the acceptRunnable method itself? Does it have side-effects? -- DF.