Closed mhinze closed 10 years ago
Several folks have asked why multiple commands can be run - in practice this does never happen. each handler uses regular old design patterns if they need to perform complex orchestrations. there's not shared state anywhere in shortbus, so I believe that one to one is the best approach.
as for commands returning a result, this is pretty clear, not only from jimmy's blog, but from the docs : http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30
The next question is why are there two separate methods now.. @jbogard says they do different things etc. I'm not sure, but I like the clear cut difference - semantically - in our consuming code.
thoughts?
Based on the research I have been doing, the command pattern shouldn't return anything. Maybe we should consider naming it something different when it returns something?
Yeah, I feel you. Couple things.. this isn't the command pattern... but also, commands don't have to have a result.. ICommand
and a void handle method still exists and is supported in shortbus. But there are times when we want to express a command but still return a result that indicates information about the resolution of the command, the new ID, a pointer to where the end result will be stored, etc. In concrete terms, I want to issue a POST to /orders and have it return a 201 with the order details page in the location header. While it was partially inspired by distributed messaging systems, it's important to keep in mind that ShortBus is for application architecture, not system architecture.
I have copied the changes you have made and my consuming application is still working. :)
Why isn't this the command pattern? Is it because of the way we are handling the command?
... based on our needs and ideas in http://lostechies.com/jimmybogard/2013/12/19/put-your-controllers-on-a-diet-posts-and-commands/