What is difference between MVC, MVP & MVVM design pattern in terms of coding c#

后端 未结 5 1102
眼角桃花
眼角桃花 2020-11-30 15:52

If we search Google using the phrase \"What is difference between MVC, MVP & MVVM design pattern\" then we may get few URL\'s which discuss the difference between MVC MV

5条回答
  •  有刺的猬
    2020-11-30 16:48

    Some basic differences can be written in short:

    MVC:

    Traditional MVC is where there is a

    1. Model: Acts as the model for data
    2. View : Deals with the view to the user which can be the UI
    3. Controller: Controls the interaction between Model and View, where view calls the controller to update model. View can call multiple controllers if needed.

    MVP:

    Similar to traditional MVC but Controller is replaced by Presenter. But the Presenter, unlike Controller is responsible for changing the view as well. The view usually does not call the presenter.

    MVVM

    The difference here is the presence of View Model. It is kind of an implementation of Observer Design Pattern, where changes in the model are represented in the view as well, by the VM. Eg: If a slider is changed, not only the model is updated but the data which may be a text, that is displayed in the view is updated as well. So there is a two-way data binding.

提交回复
热议问题