Vaadin & PureMVC

We are currently developing a small Proof Of Concept Intranet application using Vaadin/Spring/Hibernate. The initial results and very encouraging, but we would like to push it to the next level. One fundamental issue that we must solve is how to structure our code according to the MVC pattern. The prototype currently mixes all three views and would not scale in a large enterprise-level application.

I found many posts and articles talking about the integration of Vaadin and Spring MVC. I am not sure that this is the best way to go with a components based framework like Vaadin. Some GWT developers referred to the PureMVC framework (http://www.puremvc.org) as a clean way to separate the application components concerns.

Did anyone try it? Has anyone tried an alternate approach?

Any help or advice would be appreciated.

How would MVC solve your scalability issues ? A strong domain layer with a few service entry points in front of it that are called from your widgets is enough to satisfy most of my layer responsibility concerns. If you want to get the most of these frameworks in terms of productivity you need to let go of the JEE layer purity madness a bit :slight_smile: Just focus on the domain layer and the rest will become really not all that important anymore.

So far, our Proof Of Concept application has only 1 Window. Larger applications will likely have dozens of Windows; the way I see it, a Vaadin Windows is the equivalent of a page in the traditional page-oriented Web frameworks (JSF/Spring MVC/Struts). We will use Window.open() to navigate from one Window to another. Still, some “controller” component has to do the job of figuring out where to go next based on 1) where we come from and 2) what is the outcome of the performed action(s). This logic should be centralized somewhere as opposed to being scattered across many Listener components.

Perhaps I am just too biased from years of traditional Web development, but I find it difficult to abandon such a useful and proven approach. I have seen the benefit of the MVC model even in non-Web applications (e.g. VB .NET and Swing client applications).

Using layouts and views and as the building blocks does usually make sense in Vaadin applications than moving between pages. Your application can then react to actions such as selection or button click by making localized updates of only the parts of the UI that need to change. You can still handle transitions between larger application views (which can but need not fill the whole window) in different ways if you prefer to work on that level.

You could implement the navigation yourself, preferably using URI fragments (anchors) to avoid extra page reloads, but there are also frameworks on top of Vaadin that make this easy and also provide much more. See for instance the
Navigator7
and
AppFoundation
add-ons, and search for more information about them on the forum.