Why two approaches of implementing interface (view and presenter) used GWT-MVP tutorial?
My question is based on GWT Tutorial http://code.google.com/webtoolkit/articles/mvp-architecture-2.html
Here we have two pair of view and presenter
In EditContactPr开发者_JAVA百科esenter we are defining the view interface inside the presenter class
EditContactPresenter implements Presenter{
public interface Display {
HasClickHandlers getSaveButton();
....
}
}
and in case of Contact Presenter we define the presenter interface inside the View class
public interface ContactsView<T> {
public interface Presenter<T> {
void onAddButtonClicked();
.....
}
}
Why is it so? what this tutorial is trying to communicate by this....?
I am planning to keep presenter interface in separate class (not inside the view) because I may end up making multiple view for the same presenter (mobile / web) and keeping it in one view may not be that maintainable
Second, I am planning of some standardize presenter interfaces on the basic of presentation formats or template, like one which displays the list other which has Form kind of presentation.... so i will not make presenter interface per model class it would be grouped...any suggestion
It's a matter of style. GWT is open source so it is possible that this was caused by 2 people editing it. Also, they might be trying to show that either way is fine.
精彩评论