Is it valid for the model to call a method that updates the view in MVP?

StackOverflow https://stackoverflow.com/questions/19102121

  •  29-06-2022
  •  | 
  •  

質問

I have a very simple question. Someone else might have this question as well but is not asking it. So I will.

My question is: Is it valid, in the MVP model, to have the model call a method that updates the view?

Or do I have to have the model call the method and the method gets the data for the model, then the model passes that information to the presenter and the presenter sends the data to the view.

Thanks,

Darren.

役に立ちましたか?

解決

One goal of the MVP pattern is to separate the view from the model. Model, View and Presenter have distinct responsibilities.

For an effective MVP implementation, you should call a method on the presenter if your data has changed. Updating the view is the job of the presenter.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top