Reputation: 186
in MVP (Model View Presenter) pattern using base view and presenter is common practice. Can we omit them? and why do we use it at the first place?
Upvotes: 1
Views: 985
Reputation: 12953
The reason behind using BaseView
and BasePresenter
is to move common methods across child to parent, for suppose most of your views have showProgress()
method , you can stop declaring it in each child and move to parent as in
interface BaseView{
void showProgress();
}
interface SomeView extends BaseView{
void someAction();
}
interface OtherView extends BaseView{
void otherAction();
}
interface NoProgressView { // this view doesn't need progress so avoid extedning
void dummyAction();
}
Upvotes: 2