Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question 开发者_如何学运维What is your favorite GWT MVP Framework, and the reason behind your choice?
- Mvp4g
- GWTP
- GWT 2.1 Built in
- gwt-mpv
- gwt-pectin
- guit
- Other platform (please provide link)
- Own solution (with boilerplate code?)
- None
Thanks.
Updated: Added suggestions 3, 4, 5 to the list.
Updated 2: Added guit to the list.
This is a bit of a difficult one at the moment. It seems MVP is the flavour of the month (or year, as it were) but there are so many options available and very few actual tutorials.
I went through the Contacts example and kinda got it: http://code.google.com/webtoolkit/articles/mvp-architecture.html
Then I realised they had added Activities and Places in 2.1, so I looked at that example: http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
There are also numerous frameworks out there but most people seem to want to use "the google way" if possible. I'm going to give http://code.google.com/p/gwt-platform/ a go because it looks like it has some great docs, and that'[s what google is lacking at the moment.
The point is, there are no good TUTORIALS available - that's how we will all actually understand. The Stockwatcher tutorial on gwt was really useful, we could do with more like it. Here's some tidbits I've found:
- http://blog.vivavivu.com/2010/11/think-in-gwt-mvp-framework-activities.html
- http://www.bright-creations.com/blog/gwt-2-1-mvp-client-factory-example/
- http://blog.ltgt.net/gwt-21-places/
- http://blog.ltgt.net/gwt-21-places-part-ii/
- http://blog.ltgt.net/gwt-21-activities/
- http://blog.ltgt.net/gwt-21-activities-nesting-yagni/
I use GWTP because it is reasonably well documented, easy to understand and has an active user community. When I started learning the framework I had to ask a couple of questions in the forums and on both occasions, I got a friendly and helpful response on the same day from one of the authors.
I think the best technique of MVP for GWT is to have the following classes
- Model
- View
- Presenter
And make the view and the presenter interacts through a defined interface and have the presenter fetch data from the model. First, it is very simple, secondly it allows team working since we are using interfaces, every teams just have to abide by the interface.
For e.g.
1. Those working on the MODEL abide by the ServiceAync Interface
2. Those working on the view creates the User Interface and returns the
specified control to the presenter according the program interface defined by
their respective presenter
3. And Finally those working on the presenter level defines an interface which
the view has to implement
I think that the main problem that can arise in this is when one part which may be one of the View,the Model or the Presenter doesn't abide by the interface
The new version of GWT (GWT 2.1) introduced an MVP framework,
they introduced some new terminology like:
- Views
- ClientFactory
- Activities
- Places
- PlaceHistoryMapper
- ActivityMapper
you can check the details here:
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
Seems see GWT frameworks are a dime a dozen, much like Java web frameworks. That being said, I went with 4. Primarily because I wanted to do MVP without the boilerplate interfaces:
http://www.gwtmpv.org/viewgeneration.html
Docs are light, as always, but ping me if you have any questions, I'd be glad to answer them.
gwt-pectin is good too--I think gwtmpv is more succinct, but gwt-pectin has been doing the rich model/bound to a view approach for awhile.
Also using the built-in MVP framework, luckily when using Spring Roo GWT, all that boilerplate code is generated for you.
For me its GWTP, a complete model-view-presenter framework to simplify your next GWT project. available at http://code.google.com/p/gwt-platform/
I tried GWTP but it doesn't everything under the hood without you understanding it and it is hard to diverge from there way of doing things. I had this issue the first time I tried it and I tried it again too. Unfortunately, I had the same issue. I wanted to combine the Presenter and View for 1 page because it was overkill for that page. Unfortunately, I couldn't figure out how to do that so I decided that my worst fears had been realized. It's very hard to diverge from their way of doing things in GWTP. The architecture of GWT 2.1 is much more decoupled. I hadan issue with the ActivityMapper though. Now I'm looking at mvp4g.
精彩评论