Wednesday, January 12, 2011

responsibility and decision to "choose" and "provide" appropriate "Views" for an "Activity" ?

which object should have the responsibility of providing "Views" to
"Activities" ?
especially when an Activity can choose from several views depending of
the context.

- is it better if an Activity directly injects the View interfaces it
needs in its constructor ?
@Inject
MyActivity(View1 v1, View2 v2, View3, v3...)

- is it better if the Activity uses GIN Providers to get hold of Views
on demand
we would have ViewProviders,

in the two above cases, Activity itself makes the decision as to what
is the suitable view to use.

- or is it better if the Activity's ActivityFactory get hold of the
View and give it to the Activity ?
(ActivityFactory sets View for the activity:
activity.setView(view)// inside ActivityFactory


I understand there are different ways to implement this, but in your
opinion what is the best practice ?
these are the approaches I could think of:

1- Activity injects the views itself
2- Activity uses a ViewProvider to get hold of the appropriate view
depending on the context
3-given that an Activity has an ActivityFactory, this ActivityFactory
"makes the decisions"and sets the appropriate view for the Activity

two critical responsibilities:
who provides the views ?
who makes the decision on what is the suitable view depending on
context ?

--
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


Real Estate