I agree with Matt here. We also followed the same principle of having
many smaller events, meaning a Presenter will get only the event it
wants to listen to. Using an enum in the event could work too, but
again as Matt pointed out you'll end up having if-then-else trees,
which is hard to read, test and maintain. We are able to reuse some
events by making them generic.

It's going to be up to you, you can either go with a hybrid bus
architecture where classes reach into each other and listen to events
directly, or you can go for a full bus architecture where _everything_
that happens is an event. The latter has the advantage of being highly
decoupled, while the former has the advantage of having fewer event
classes and maybe easier to understand the flow because there is some
coupling.

--
Arthur Kalmenson



On Tue, Nov 17, 2009 at 9:53 AM, Matt Bishop <[email protected]> wrote:
> Your simple, many-classes design is actually a Good Thing.  Event
> objects should really only do one specific step in the workflow of
> your application.  Lots of small, discrete and completely specific
> action classes is far preferrable to a smaller set of classes that
> contain if-then-else trees and switch statements.
>
> Don't be afraid of lots of small classes, it is usually a good thing.
> As Grady Booch once wrote, if your application code is too complicated
> to understand, break things down further with more classes.
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to