Composite Guidance for WPF : MVVM vs MVP

前端 未结 4 744
挽巷
挽巷 2020-12-05 03:41

I am confused. Maybe you can help me :)

I have been following the guidance of CAG and found the MVP pattern very natural to me. Suppose I have a UI-ready Model (for e

4条回答
  •  情话喂你
    2020-12-05 04:05

    Ad.3. It may seem that you repeat yourself by exposing Model in ViewModel, but what you really do is abstracting the Model, so that View knows only about this abstraction (View knows only about ViewModel).

    This is because changes to Model shouldn't break the View. Also, your Model can be implemented as many different services that get data from different sources. In this case you wouldn't like View to know about all of them, so you create another abstraction - ViewModel.

提交回复
热议问题