Developing with Google Web Toolkit (GWT)

64 views
Skip to first unread message

Daniel Wellman

unread,
Oct 6, 2012, 3:05:16 PM10/6/12
to growing-object-o...@googlegroups.com
Hi all,

After a few years away from it, I'm using GWT again on a project (an existing application written using GWT 2.4), and I've noticed a few things in the community:
- Model-View-Presenter seems to be quite popular
- Developers who write tests for their GWT applications seem to prefer writing fast plain-ol' Java tests rather than the GWTTestCases.  (yay!) And GWTTestCases are still orders of magnitudes slower than plain ol' Java tests.
- The GWT article on MVP (https://developers.google.com/web-toolkit/articles/mvp-architecture) seems to suggest a style of very dumb views -- each view exposes an interface containing getters for each of the components on the page, and the presenter adds all the event handlers and callbacks.  This seems to expose a lot information about internals in the View to its Presenter ("Hey View, wire me up!") in return for being able to test the wiring in a fast Java test case.

Also, GWT introduced some concepts called Activities and Places which as best I can tell seems to be an upgraded browser History library, and somehow MVP gets smooshed in here

I'm wondering if there are any folks who have some recent experience with GWT would be willing to share any insights they've picked up with GWT while practicing the GOOS principles?  

Also, there seems to be some alternate community testing library, gwt-test-utils (https://github.com/gwt-test-utils/gwt-test-utils) which seems to do some sort of magic to allow you to run tests that use widgets inside a plain ol' Java test.  Has anyone used this?

Thanks!

-d

I've collected a few links from the GOOS archives that mentioned GWT that I've included below for future readers:

David Peterson

unread,
Oct 7, 2012, 2:49:43 PM10/7/12
to growing-object-o...@googlegroups.com
I have used GWT, although I'm not using it right now. 

I agree with what you're saying about that GWT article on MVP. I think the views are too dumb and expose too much implementation detail.

It's quite easy to hide GWT-related stuff completely from the presenter. Although doing so makes the GWT component slightly less dumb, I'd say it pays off. The presenter code becomes much more readable and having the two concerns separated makes it easier to alter the UI and to test the client-side logic of the application without needing GWT. 

The thing I love about using GWT is that if your server-side code is written in Java, you can insert some adapters and hook the client-side to the server-side and have it all running in the same JVM without needing to start up any servers or anything.

I find it helpful to imagine I'm going to reuse the presentation logic on a different platform, such as Swing or Android, and that helps me avoid coupling my presenters to GWT.

Recently, I started developing my own components with complex behaviour and discovered I needed two interfaces: "View" and "Look". I've written about it here. The presenter in the application code uses the View, but the component itself has its own presenter which I call a Feel (as in Look and Feel).

David
Reply all
Reply to author
Forward
0 new messages