GWT & MVP

94 views
Skip to first unread message

Alex

unread,
Apr 5, 2011, 6:04:47 PM4/5/11
to Google Web Toolkit
I've been looking into GWT and MVP recently and to be honest I'm very
confused. My project involves around 40 different pages / individual
views, or whatever the correct terminology is. I've been reading
tutorials that follow Model-View-Presenter and others that use
Activities and Places.

Which one should I be using?

Many thanks,
Alex

Konstantin Zolotarev

unread,
Apr 6, 2011, 3:50:13 PM4/6/11
to google-we...@googlegroups.com
I think first you should read about gwt platform (http://code.google.com/p/gwt-platform/) and  google-gin (http://code.google.com/p/google-gin/

Harald Schilly

unread,
Apr 6, 2011, 4:00:18 PM4/6/11
to google-we...@googlegroups.com
On Wednesday, April 6, 2011 12:04:47 AM UTC+2, Alex wrote:
Which one should I be using?

You are maybe confused, because some terms are more theoretical (or abstract) and others are used in the Code. Also, there is not only one way to do MVP in GWT. You can check out mvp4g if it fits more your mental model. 



H

Brian Lough

unread,
Apr 6, 2011, 10:35:12 PM4/6/11
to google-we...@googlegroups.com
No offense to the other posters, but I wouldn't go anywhere near "platform" or "mvp4g" right off.  Just confuses the issue.  Having recently been where you're at, I'd go here first: http://martinfowler.com/eaaDev/uiArchs.html.  That should shed more light on why MVP is of interest period.  "Humble View" is definitely an item to read.  I had to implement "The Humble Dialog Box" with gwt-presenter and all unit/integration tests before I groked just the _why_ of why I'd want to pursue MVP.  As of this post, I have checked out gwt-platform, mvp4g, Guice 2.0 and Guice 3.0 MVP -- still haven't decided the direction I'm headed. 

IMHO, Schilly was right in that the code muddles the theoretical discussions or visa-versa.  MVP is a concept.  The frameworks are based upon that, but they possess different implementations based upon the concept.

Good luck!


--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


-sowdri-

unread,
Apr 7, 2011, 12:48:16 AM4/7/11
to google-we...@googlegroups.com
Better to use MVP with activities and places as suggested by official GWT team. 

Thanks,

David Chandler

unread,
Apr 7, 2011, 11:39:35 AM4/7/11
to google-we...@googlegroups.com, -sowdri-, ale...@gmail.com
Thanks for the vote of confidence, but let me suggest that some of the confusion around MVP results from overloading the term (I bear some of the blame here, sorry).

Three key ideas of MVP proper are
1. Views are interfaces (so they can be tested without GWTTestCase, among other reasons)
2. Presenters are POJOs that contain no Widgets
3. Views and presenters refer to each other only via interfaces (and in the original style of MVP, a presenter may call methods on the view interface, but not the other way around)

Ray Ryan's famous I/O talk in 09 also mentioned place/history management and the Command pattern, which are very useful ideas but not part of MVP proper. Various 3rd party MVP frameworks offered all these capabilities together as "MVP" and the GWT docs refer to Activities and Places as the MVP framework, but they're really not MVP proper, which has no doubt led to some confusion. GWT's Activities and Places offer place/history management, but require no View or Presenter classes so you are free to create your own or use one of the 3rd party frameworks for these. I'm sure the community will have further recommendations :-)

HTH,
/dmc

On Thu, Apr 7, 2011 at 12:48 AM, -sowdri- <sow...@gmail.com> wrote:
Better to use MVP with activities and places as suggested by official GWT team. 

Thanks,

--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
David Chandler
Developer Programs Engineer, Google Web Toolkit
w: http://code.google.com/
b: http://googlewebtoolkit.blogspot.com/
t: @googledevtools

Jeff Larsen

unread,
Apr 7, 2011, 11:45:07 AM4/7/11
to google-we...@googlegroups.com, -sowdri-, ale...@gmail.com
I don't think you can go wrong with using either gwt-platform or mvp4g.  They're both really solid mvp frameworks.

Y2i

unread,
Apr 7, 2011, 12:19:29 PM4/7/11
to google-we...@googlegroups.com

Barry Ard

unread,
Apr 7, 2011, 12:59:49 PM4/7/11
to Google Web Toolkit
I found this mvp discussion to be the most value to me:

http://jectbd.com/?p=1397

Barry

Jens

unread,
Apr 7, 2011, 6:36:16 PM4/7/11
to google-we...@googlegroups.com, ale...@gmail.com
On Thursday, April 7, 2011 5:39:35 PM UTC+2, David Chandler (Google) wrote:

Ray Ryan's famous I/O talk in 09 also mentioned place/history management and the Command pattern, which are very useful ideas but not part of MVP proper. Various 3rd party MVP frameworks offered all these capabilities together as "MVP" and the GWT docs refer to Activities and Places as the MVP framework, but they're really not MVP proper, which has no doubt led to some confusion. 

Thats why I would change the GWT docs as soon as time allows. Someone new to MVP and activity/places will definitely get the wrong idea of both and gets confused. There are many topics/posts like this one in this group.

@Alex: As David points out, the MVP pattern has nothing in common with GWT's Place/History management framework (often referred to as GWT MVP). If you use GWT places/activities your app will gain bookmarkable urls that represent a place/application state and whenever such a url is visited a corresponding activity will be started. This activity is then responsible for attaching some UI/widgets to an area of your webpage. If this UI is complex and has user interaction elements then you could implement this UI with the MVP pattern to separate the UI from the logic that will be performed when the user interacts with this UI. And once you decide to use the MVP pattern then its in most cases easier to let the activity be the presenter. But its also possible to implement a separate presenter and let the activity hold a reference to it.

J.

credmond

unread,
Apr 7, 2011, 7:05:59 PM4/7/11
to Google Web Toolkit
Personally, I'm fairly new to GWT, and yes, the docs are pretty
confusing, unhelpful, and inconsistent, and I'm not new to web
frameworks. I wish I had taken down all the problems, contradictions,
and lack of clarity that I noticed. Very strange for "Google".

Regarding MVP, I steer clear of Activities and Places because I think
for more complicated UIs and nested views, etc., things become too
messy and even impossible. They're too new and there isn't a single
decent example that implements them. The updated Expenses sample app
which uses Activities and Places -- and is shipped with GWT -- uses
them but totally incorrectly in terms of MVP (tonnes of UI code in
presenters, etc., if I recall).

There's nothing wrong with do-it-your-own-way MVP as described in the
two links at the top of: http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
...

Trying to tie MVP with history and event management, etc, and
everything else, is confusing for the beginner. The docs are not doing
GWT any justice and if it hadn't got "Google" in the name I would have
thought more than twice about adopting it.

I'm not unhappy with my choice though, but I still feel the docs need
a complete re-work. Slightly off topic, sorry.

</rant>

Brian Lough

unread,
Apr 7, 2011, 9:26:42 PM4/7/11
to google-we...@googlegroups.com
Nicely done, David.  +1
Reply all
Reply to author
Forward
0 new messages