Re: GWT Base Application Featuring Best-Practice Technologies
Why are your activities singletons? (they're injected into the ActivityMapper, which is instantiated once only, so in practice they are singletons, even if not declared as such in your GIN bindings). Activities are "cheap", so unless you have to maintain state between use (I believe it's not the case for the PersonEditActivity, it could be for the PersonListActivity but not currently in your code), you shouldn't use singletons.
Note that in this case, you should call setPresenter from within your activity's start() (to make sure an "instantiated but not started" activity doesn't set itself as the "presenter for the view" and "steal" this role from an "already started" activity); and I like to call setPresenter(null) from onCancel and onStop.
-- They're also instantiated eagerly (because they're injected in the ActivityMapper, instead of injecting a Provider), which means their view is instantiated eagerly too. In such a simple app that's not really a problem because you're likely to "use" all the activities and their views, but as the application grows, it means you're instantiating things that you might never use.
Finally, you should probably extend AbstractActivity rather than directly implement Activity (there was a discussion a few months back about possibly introducing new methods to the interface, which would be breaking changes if you implement it directly, whereas there would be a default implementation in AbstractActivity)
BTW, I've only looked at the activities.
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home