Translating GWT MVP Pattern to Vaadin
After several months developing an application based on GWT, using MVP pattern + Hibernate, I've come to a point where every small change in the application is a pain, and the widgets look very poor.
I've also evaluated Vaadin, and it looks very promising. The way that databinding allows me to forget DTO conversion, seems interesting, 开发者_如何转开发but also the final result looks very professional, so I'm almost convinced to redo the work with Vaadin.
The point, is that I like very much the code cleanness of MVP in GWT, but I haven't been able to find a reasonable explanation of how to adapt it to Vaadin, without throwing away most of the work already done.
My main concerns for code adaptation is how to use GWT classes, History and Eventbus, with Vaadin.
Has anybody gone through this process before that can show us the way?, or, maybe there are reasons to not mess with MVP when working with Vaadin, that I can't foresee by now?
Thanks for the answer Jonas. I've checked Navigator for Vaadin, but looks beta Finally I decided not to stick to GWT MVP, and follow one of the patterns provided in Vaadin.
The most complex was to move the login procedure from GWT-mvp to Vaadin, but with the help of the wiki guide has not been so tough.
I've done it in a week, and I feel a great relief to do not have to deal with complex DTO conversion and RPC calls.
If you are using History for linking, see http://vaadin.com/addon/navigator Even if you choose not to use the add-on itself, you might want to peek the sources - they are just couple of hundred lines.
While talking about the wiki, I had the idea to search it with MVP word.
I found the Building Vaadin Applications on top of Activiti page which has a code using a MVP schema.
It uses the peholmst/MVP4Vaadin project.
Note there is also the MVP and UiBinder for Vaadin Add-on
I haven't used yet these resources...
MVP in actually the prefered way to structure the presentation layer of Vaadin applications reccommended and used even by Vaadin development team. Actually, one of the main parts of official Vaadin Advanced Training course is dedicated to the Model View Presenter pattern. I attended this course and I found the MVP part of the training the most useful part.
Basic overview of MVP is now even part of the Book of Vaadin - Advanced Application Architectures
MVP is more of an architectural principle to divide presentation layer than an actual design pattern in GOF sense. Therefore there are many different ways of implementing it, each with different advantages and disadvantages. Proper implementation should be chosen depending on the concrete application. In case of simpler applications, better solution might be not to use it at all as the benefits gained would not necessary outweigh increased complexity. In such cases, Vaadin declarative format could be an interesting alternative to achive a division of the presentation layer.
精彩评论