One good place to start are Thomas Broyer article on 2.1 MVP in case you haven't read them already: http://tbroyer.posterous.com/gwt-21-places http://tbroyer.posterous.com/gwt-21-places-part-ii http://tbroyer.posterous.com/gwt-21-activities http://tbroyer.posterous.com/gwt-21-activities-nesting-yagni
I have never tried writing a complete app using 2.1 MVP classes, so my analysis here is mostly based on the above articles and the javadoc. As a result, I'm pretty sure there are some mistakes and I'd be more than happy to listen to corrections from people who have used the 2.1 MVP clases. If you don't have the time to read what follows my conclusion is that: - 2.1 MVP is closer to the metal and will need you to write more code ; - 2.1 MVP takes the stance that presenter hierarchies are not desirable, GWTP takes the opposite stance ; - GWTP MVP's have more features out-of-the-box ; - 2.1 MVP are still meant to sit behind a 3rd party tool, i.e. SpringRoo or (eventually) GWTP. 1) Place mechanism GWTP tries to make places really easy. A simple annotation is often all you need to get your presenter to respond to a place. If you need parameters your parse them in your presenter's prepareFromRequest() method. This handles the 95% use case in a few lines of code. For the exceptional situations where you want to do something else than reveal a presenter on a place request (reveal non-nested presenters, trigger an action, ...), you will have to go through the event bus. GWTP shadows each of your presenter with an automatically generated proxy (hurray for GWT's generators!). This is a light weight class that listens on the event bus even before the presenter has been instantiated. As a result GWTP's will always lazily load your presenter. An annotation also makes it trivial to have your presenter sit behind a GWT code splitting point. As a bonus, this proxy is the perfect place for your presenter to listen to events that may be of interest to him before it's instantiated. In GWT 2.1, places are a subsystem entirely decoupled from the MVP layer. You connect them via the ActivityManager and ActivityMapper, which lets you lazily load or code split your presenters. The ActivityManager and ActivityMapper are not generated for you however, you have to maintain them manually. If you want your presenter to listen to other events before it's instantiated, then you will probably also have to create a proxy manually (or accept that your presenter is not lazily instantiated). Some features are offered by both framework (i.e. user confirmation before navigation), but GWTP places offers more features out-of-the- box: - Gatekeepers makes it very easy to implement a right management mechanism client-side. For example, you can make a presenter accessible only to the admin, another one only to logged in users, etc. - Hierarchical places make it easy to implement breadcrumbs or a "back to what I was doing before" link 2) Presenters (Called activities in 2.1) GWTP offers two different concepts: Presenters, which are singletons and PresenterWidget which can be non-singleton. These can be nested in one another, offering a powerful set of cascading lifecycle hooks that you can override: onBind, onReveal, onReset, onHide and onUnbind. These are cascading in the sense that a call to onHide on a parent presenter will cause onHide to be called on the child presenters. It makes it easy to organize your app logically. This ability to nest presenters doesn't imply higher coupling since the nesting is entirely done via the event bus. A parent presenter does not know who is child are until they are connected and vice- versa. This makes it very easy to reorganize your app layout, either dynamically or based on the configuration. For example, you can make a different hierarchical layout for your mobile version. Activities in 2.1 takes the stance that presenter nesting is not required. This means, for one thing, that you will have to think in advance as to how you want to split your screen in display regions. Modifying the layout within one presenter means you have to modify the global screen layout. This also means that you cannot get cascading effects: you will have to manually stop all the presenters that need to go away when you navigate. For me, this last point is the most important turn off. In my experience, building reusable components in the form of PresenterWidgets (widgets with a nice separation between logic and view) is really useful. In GWT 2.1 you would have to do these manually, and to manually hook them to the lifecycle methods of your presenter (mayStop, onStart, onStop). I'm sure users of 2.1 MVP have found a solution to this -- or maybe it's just a question of approaching the problem differently. * In conclusion It looks to me, and I remember hearing Thomas saying something to that effect, that GWT 2.1 MVP classes are still meant to sit behind a third party tool, be it SpringRoo or (eventually) GWTP. In their current form they offer a very nice decoupled abstraction between the various components of a well-written application: MVP, places, event bus. But in order to write such an application effectively you have to bring these components together in a way that helps the developer get more things done with less code. This has been GWTP's goal from day one and I think its large user base is an indication that we succeeded. Looking forward to hearing from others on that topic! In the end, I'll gather everything into a wiki page on the GWTP wiki. Cheers, Philippe On Sep 29, 4:25 pm, Travis Camechis <camec...@gmail.com> wrote: > understand. We are mainly trying to figure out which MVP framework to start > with but not sure which one would be the wise decision. Can you tell me > some of the benefits of GWTP over 2.1 MVP are? > > On Wed, Sep 29, 2010 at 6:38 PM, Christian Goudreau < > > > > goudreau.christ...@gmail.com> wrote: > > There's no big plan for now, since features are moving a lot in trunk of > > Gwt, but I can assure you that we will include every Gwt core features that > > we can. > > > Cheers, > > > On Wed, Sep 29, 2010 at 6:26 PM, Travis Camechis <camec...@gmail.com>wrote: > > >> Does anyone know what the plan is for GWT-Platform with the upcoming 2.1 > >> release? Will GWT-Platform integrate the new features or some of them? > > >> On Wed, Sep 29, 2010 at 4:04 PM, Bayard Randel > >> <k...@bestpractice.net.nz>wrote: > > >>> Yes, I'm currently working on a GWTP project using 2.1M3 without any > >>> issues. > > >>> On Sep 30, 9:01 am, tc <camec...@gmail.com> wrote: > >>> > We currently looking at starting a new project. I like what GWT 2.1 > >>> > provides. Does anyone know if you can use GWT-PLATFORM with 2.1M3+? > >>> > The main thing we would like to use if using GWT-Platform is the Cell > >>> > widgets. > > >>> -- > >>> You received this message because you are subscribed to the Google Groups > >>> "Google Web Toolkit" group. > >>> To post to this group, send email to google-web-toolkit@googlegroups.com > >>> . > >>> To unsubscribe from this group, send email to > >>> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2Bunsubs > >>> cr...@googlegroups.com> > >>> . > >>> For more options, visit this group at > >>>http://groups.google.com/group/google-web-toolkit?hl=en. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Google Web Toolkit" group. > >> To post to this group, send email to google-web-tool...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2Bunsubs > >> cr...@googlegroups.com> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/google-web-toolkit?hl=en. > > > -- > > Christian Goudreau > >www.arcbees.com > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Web Toolkit" group. > > To post to this group, send email to google-web-tool...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2Bunsubs > > cr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.