0

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
Saket Bansal
  • 156
  • 1
  • 12
  • possible duplicate of [MVP: Should the View implement a Presenter's interface or vice versa?](http://stackoverflow.com/questions/3309029/mvp-should-the-view-implement-a-presenters-interface-or-vice-versa) – Robert Munteanu Sep 07 '10 at 17:10
  • Thanks for response, agree it is duplicate, but answers given in that post are not sufficient , as of now i have defined interfaces in separate files and view and presenter are accessible to each other by dependency injection – Saket Bansal Sep 07 '10 at 23:47
  • The answer from Roberts link is adequate for most cases, although because you're using dependency injection it does matter where the interface is defined. Only the author can really answer why they chose to define it there. For your case, I think you're on the right track by moving the Display interface to its own file. – Brian K Blain May 25 '11 at 20:56

1 Answers1

0

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.

jgleoj23
  • 262
  • 2
  • 9