Hi Liz
Elizabeth Keogh wrote:
Here's a JBehave pattern which is starting to become familiar to me.
* Create an initial Given which starts up my application. Dependency
inject or otherwise establish hooks into everything which other
Steps will need to access.
* Put those hooks and collaborators into the World.
* Write my Events, Outcomes etc. Get things which I need from the
World.
* Desperately try to remember what class each of the things in the
World actually had, and what keys I put them in with.
* Realise that I can't remember both and invent a WorldKeys class to
halve the problem.
* Refer back to the initial Given repeatedly to remember what class
things were.
* Cast the objects I'm getting out of the World into something more
meaningful than Object.
Wouldn't it be cool if, instead of having a World which was just a hash
set, I had one which exposed the things I was actually concerned about
in the context of my stories?
So, I could have:
public MyShop implements World {
StockCounter getStockCounter();
Till getTill();
void putMoneyInTill(Money amount);
}
or:
public HellboundTheGame implements World {
ForcedTimer getTimer();
Pit getPit();
WindowWrapper getGameWindowWrapper();
}
etc.
I thought about this last night when listening to your conversation
about personas.
So my first Given, ideally, would look like:
given(World);
That way, all I need to do is cast the World, once, rather than
everything I get out of it. (And I won't even need to do that when we
support 1.5 ). We can provide a HashMapWorld by default, for those users
who don't want to set one up themselves.
Thoughts?
I agree - a World with just hash maps is too "harsh" :-)
But I'm not clear on how you propose to go about it. Would you
1 remove current get/put methods from interface - and move them to implementation, so it'd have to
be cast to HashMapWorld to be used? What would the World become, just contain the method clear()?
2 extend interface with bespoke method?
Cheers
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email