On 20 Jul 2013, at 13:04, Graham Ashton <gra...@effectif.com> wrote:

> What responsibilities does a KitchenHandler have? There's no such thing in 
> real life; could its existence be a side effect of the implementation?

I could call it Chef, or Cook, or KitchenAssistant or something. Everything in 
the system is the result of being instructed to perform a command, and the 
generic term for these is "handler", hence I used it above. I'm currently 
refactoring from an Application Service pattern with methods that accept 
hashes, to command messages being sent over a bus, because it gives me some 
useful stuff for free. I haven't got far along this route yet, so I don't know 
what good metaphors (if any) I'll find for the handlers yet.

> Could you keep the bus, but rework things so that you deal with a Kitchen 
> object instead? Could you send it a message via your bus just by calling 
> kitchen.turn_on_kettle ?

Actually, yes I could do this, although I think not in the way you're 
describing. I could keep the Application Service methods, and re-implement them 
to send command messages. Alternatively, I could implement all the command 
handlers to call existing service methods. I suspect I'll want one or other of 
these, so I've got a less verbose API for use in Rake tasks, in a console etc. 
But I don't know what it will look like yet.

> I realise that you're dealing with a message bus, which implies that there 
> might be all sorts of bits of gumph inbetween your user of the message bus 
> and the kettle, but might you be able to re-jig your objects this way anyway?

Actually it's really simple, but I want to keep a clean separation. One of my 
HTTP resource POST tests is basically "assert <this command> was put on the 
bus". Using command messages means I can leverage a basic message typing system 
I built for events, so it's impossible to put a malformed command on the bus, 
which also makes it trivial to correctly return 400 Bad Request over HTTP.

> Just throwing it out there... I appreciate it might not be an actionable or 
> useful thought.
> 
> I'm still only a fifth of the way through his book, but I suspect it might be 
> what David West might ask.
> 
> http://www.amazon.co.uk/Object-Thinking-DV-Microsoft-Professional-David/dp/0735619654/ref=pd_sim_b_3

I just went to add this to Goodreads and found it already there :-) I've bumped 
it up my list though.

> Another unrelated thought; could you use "publish" instead of "send"?

Yes, in a way I mentioned in a different email. But it'd need me to make my 
message typing more sophisticated. I think this is the way I will go 
eventually, in which case I might decide to just use "publish". I'm not sure 
yet.

Thanks for your thoughts

Ash

-- 
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashmoran

-- 
You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nwrug-members+unsubscr...@googlegroups.com.
To post to this group, send email to nwrug-members@googlegroups.com.
Visit this group at http://groups.google.com/group/nwrug-members.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to