Re: Up to date GWT-Tutorial that put things together
Some inline comments below
- Coupling the view to a "foo" activitiy (P in MVP)
An Activity does not have to be a presenter. Always keep that in mind. An activity is simply something that starts/stops once a user visits/leaves a place. It can often take the role of a presenter just fine but if for any reasons things feel uncomfortable while writing an activity you might want to think about it.
- Use of Event-, Activity- and PlacesManager ("AppController" is a deprecated pattern(?))
Using EventBus gives nice decoupling while being able to broadcast general events in your app. Creating events requires some boilerplate code to write so you may want to check out https://github.com/google/gwteventbinder to save you some code.
Places are GWT's way to handle navigation and support the browser back/forward buttons. I would definitely use it because its always annoying if you can not send someone else a link to "a place" in your app. It also just feels more natural if you can use back/forward buttons of the browser because thats what you do all day when surfing the web.
- Use of ClientFactory for reusable Views
ClientFactory a form of dependency injection and is more about swapping view implementations easily. This is helpful if you want to share presenter logic but need different view implementations for desktop/tablet/mobile. It also comes in handy for testability of your presenters. During testing your view interfaces can be implemented by fake implementations using a FakeClientFactory. If you would use your real GWT views in tests then you would need to use GWTTestCase which is really slow compared to pure JUnit tests or you have to use a library like https://github.com/google/gwtmockito which does some magic to avoid using GWTTestCase even if you deal with real widgets.
The code you write when using the ClientFactory pattern can also be generated by using https://code.google.com/p/google-gin/ .
- Use of RequestFactory and EntityProxy as "M" part for DataBinding (using annotations)
GWT's DataBinding features is the Editor Framework which also works with plain POJOs / Beans. So you are not required to use RequestFactory in order to be able to use DataBinding features. Also GWT's Editor Framework is not a "real time" data binding. What it does is it copies data from your model into the view (by using annotations and naming conventions), then you can edit everything in your view and finally you can call a flush() method which copies everything from the view back to the model. So there is no live update of label x while typing things in textbox y.
A tutorial that uses all of the above mentioned paradigms at once would be much appreciated.
Actually these things are all covered on gwtproject.org, except ClientFactory. But I think there is a GWT example project in the SDK that uses the ClientFactory pattern.
UiBinder: http://www.gwtproject.org/doc/latest/DevGuideUiBinder.html
Activities & Places for managing navigation: http://www.gwtproject.org/doc/latest/DevGuideMvpActivitiesAndPlaces.html
MVP using UiBinder: http://www.gwtproject.org/articles/mvp-architecture-2.html
RequestFactory: http://www.gwtproject.org/doc/latest/DevGuideRequestFactory.html
Editor Framework: http://www.gwtproject.org/doc/latest/DevGuideUiEditors.html
-- J.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home