MVC, MVVM and MVP

MVC:

  • View is to demonstrate to the external interface
  • Internal Model Controller data model management, and various data manipulation tools
  • Controller is responsible for updating changes to the Model View
  • Controller is responsible for handling events from the View
  •  

     


MVVM:

  • Model provides the data model
  • View responsible view shows
  • Description View ViewModel for status, for example, the color information of View, characters and the like displayed in the attribute class, the abstract View into a special model, and hold and manage Model, maintenance service logic

 

 

 

MVP:

  • V-MVP and UIView layer is composed UIViewController
  • view presenter will be entrusted to its own operating (simply the presenter send commands to control the view of the interaction)
  • presenter has a logical view of interaction
  • with the presenter layer communication model, and the data conversion paired adaptation data and updating the UI view

  MVP is to decouple the M and V (a series of benefits), decoupled manner, by increasing the layer Presenter layer. However, coupling this kind of thing is an objective reality. We decoupling of M and V In this way, but will increase the coupling and P V, M and P. Presenter increase in the external layer interface exposed, should not contain any information about the model. And between P and V should be oriented programming interface. If such a change or variation of an interface for other m is no perceptual achieve decoupling state.

 

Guess you like

Origin www.cnblogs.com/jiefangzhe/p/12655340.html