Friday, July 5, 2013

Using a Publish-Subscribe messaging pattern in Vaadin

The events system described by the Book of Vaadin is quite primitive. It's a standard Observer pattern (aka Listener pattern). 

Unfortunately, since the Listener requires access to the source object, this makes it highly coupled (the listener has to know about the source). 

What's worse is, in a practical sense, since Vaadin events do not "bubble" (not on the server side at least), its very difficult "get the handler to the required component" without violating all kinds of information hiding best practices.

What we really want is a publish-subscribe architecture that is similar to Parsley's in Flex.

GWT does provide a SimpleEventBus. And Vaadin does include this. And blogger Alex Tretyakov has here a great example of how to use it. As of this writing, its the best example out there.

No comments:

Post a Comment