From: Jens Winter on
Hello,

I'm looking for the name of a OO construct. It is used in jMock for
example and looks like this:

mockSubscriber.expects(once()).method("receive").with( eq(message) );

It is used to increase the readability of code. I think there is a term
for such constructs. But I can't remember it.

Ciao,
Jens
From: H. S. Lahman on
Responding to Winter...

> I'm looking for the name of a OO construct. It is used in jMock for
> example and looks like this:
>
> mockSubscriber.expects(once()).method("receive").with( eq(message) );
>
> It is used to increase the readability of code. I think there is a term
> for such constructs. But I can't remember it.

I never heard of jMock, but this just looks like basic callback
registration via something like the Observer pattern.



*************
There is nothing wrong with me that could
not be cured by a capful of Drano.

H. S. Lahman
hsl(a)pathfindermda.com
Pathfinder Solutions
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
info(a)pathfindermda.com for your copy.
Pathfinder is hiring:
http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH



From: Jens Winter on
H. S. Lahman wrote:
> Responding to Winter...
>
>> mockSubscriber.expects(once()).method("receive").with( eq(message) );
>>
>> It is used to increase the readability of code. I think there is a
>> term for such constructs. But I can't remember it.
>
> I never heard of jMock, but this just looks like basic callback
> registration via something like the Observer pattern.

Hello H. S.,

What I meant was that the construct uses methods that can be
concatenated. This way it is possible to for example initialize an
object that has a hierarchical structure.

An alternative sample to the above code could be something like this:

Expectation expectation = new Expectation();
expectation.SetMethod("receive");
expectation.SetExpectedResult(message);
mockSubscriber.AddExpectation(expectation, 1);

Uhm, I think I will have to come up with another (better) example some
time. :)


Ciao,
Jens
From: Jens Winter on
Hello H. S.,

What I meant was that the construct uses methods that can be
concatenated. This way it is possible to for example initialize an
object that has a hierarchical structure.

An alternative sample to the above code could be something like this:

Expectation expectation = new Expectation();
expectation.SetMethod("receive");
expectation.SetExpectedResult(message);
mockSubscriber.AddExpectation(expectation, 1);

So, I don't think the term has something to do with callback or observer
pattern.

Uhm, I think I will have to come up with another (better) example some
time. :)


Ciao,
Jens
From: breeto on
I think "fluent interface" might be the answer you're looking for...

http://www.martinfowler.com/bliki/FluentInterface.html


Jens Winter wrote:
> Hello H. S.,
>
> What I meant was that the construct uses methods that can be
> concatenated. This way it is possible to for example initialize an
> object that has a hierarchical structure.
>
> An alternative sample to the above code could be something like this:
>
> Expectation expectation = new Expectation();
> expectation.SetMethod("receive");
> expectation.SetExpectedResult(message);
> mockSubscriber.AddExpectation(expectation, 1);
>
> So, I don't think the term has something to do with callback or observer
> pattern.
>
> Uhm, I think I will have to come up with another (better) example some
> time. :)
>
>
> Ciao,
> Jens