Hi Kwhit,

   I believe that this is what I have been calling the Controller
(Event Bus, passing Events (Command Objects)).   Perhaps why I have
had some difficulty working with others (GWT) MVC frameworks of late.

So I have a Event Object (Command) with a Object value field
http://cvs.adligo.org/viewvc/adi/src/org/adligo/i/adi/client/EventDelegator.java?view=markup
http://cvs.adligo.org/viewvc/gwt_util/src/org/adligo/gwt/util/client/UserEventController.java?view=markup
http://cvs.adligo.org/viewvc/gwt_util/src/org/adligo/gwt/util/client/BaseController.java?view=markup
http://cvs.adligo.org/viewvc/gwt_util/src/org/adligo/gwt/util/client/SystemEventController.java?view=markup

View->Sends Event->UserEventController->Delegates to some code
View<-Recieves Data<-SystemEventController<-Delegated Code responds
So the 'Event Bus' is made up of two major sections
tword control code
from control code

Each section may have multiple parts so things can be added (removed)
from the bus.  I wrote this before the 2009 Google IO MVP
presentation, and was trying to combine newer MVC frameworks (Spring,
Struts) with older GoF smalltalk C++ ideas about fat clients (lexi).

So I made some generalizations (more casting since Object is often my
reference type), and my View and Presentation code is generally
packaged into a class name ending with Panel (AddressPanel for
instance).

In your example I would have the SavePhoneNumberButton as the Source
of the event and the NewPhoneNumber as the value.  The event would get
to some rpc code, onSuceess would change the NewPhoneNumber value in
the Event object and pass it back to the View.

So to sum up, I think the Command Pattern with the Event Bus is the
way to go, and works well for me!  I called this a MVC framework.

Cheers,
Scott


On Jul 11, 1:41 am, Kwhit <kwhitting...@gmail.com> wrote:
> Just throwing up an idea here to see how many bullet holes it comes
> down with.
>
> I'm playing around with the command pattern which is a hot topic at
> the moment and wondered why it shouldn't be merged with the EventBus?
> The command pattern proposed by RR has to add a response object - the
> original doesn't (I don't have a GoF copy to hand), using and event
> bus would remove the requirement for it.
>
> Using the example presented by RR.
>
> 1/ User clicks on 'save' to save the edited phone number
>
> 2/ Presenter creates an RpcCommandEvent{<save>, <new phone number>}
> and fires it to the eventBus
>
> 3/ RpcPipe, listening for RpcCommandEvent events, ships them off the
> to the server
>
> --- Server side ---
>
> 4/ RpcPipeService receives the event and invokes a specialized handler
>
> 5/ The handler verifies (for the sake of the example but I would
> normally do this client side) the new phone number, finds it OK and
> updates the storage
>
> 6/ Handler returns new phone number for contact ID x
>
> 7/ RpcPipeService ships (returns) the response on across the pipe
>
> --- Back on the client side ---
>
> 8/ RpcPipe fires the RPC return value as an event on the bus
>
> 9/ Listeners to ContactInfoUpdated events update the phone number
>
> I, in my ignorance, find the above a net gain
>
> * +ve: One pipe fits all, no need to update the mechanics of the RPC
> * +ve, -ve: The event designer has to know that the event should be
> shipped over the pipe
> * +ve: The statefulness of the RPC mechanism (every request has a
> response) fades away
> * +ve: In fact the Pipe itself could disappear with a bus on the
> server (see below) - end to end unit testing
>
> In my event driven fever I would also like to have an event bus on the
> server so that the handlers could register themselves for events but I
> not worried too much about that yet.
>
> OK fire away!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to