DI/wiring

S

Stefan Ram

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.
 
D

Daniele Futtorovic

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?
 
M

markspace

To add to all the excellent replies: a better example would be changing
channels on your TV - you don't use your remote to ask your TV to "accept"
channel 1, you tell it to "set" the channel to 1.

Set phasers on stun?

I may be creating a backronym here, but to me the idea of changing state
on an object via "set" goes back to terminology used in circuit theory,
when bi-stable latches where used for memory. One state was "set" and
the other state was "reset." So when you added some state you were
generally using the "set" line to do so.

<http://en.wikipedia.org/wiki/Flip-flop_(electronics)>

So this would be a technical term, not related directly to English
language use of the same name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top