Similarities and differences between MVC, MVP and MVVM

No1:

Model is generally used to maintain the data state of the program, such as data storage, network requests, etc.

No2:

Where is applied to MVC in Android development: For example, ListView and Adapter, if ListView is regarded as the View layer, then Adapter can be regarded as Controller, and the related implementation class for obtaining ListView display data is regarded as Model.

If you magnify your thinking, you can also view the xml layout / View class in Android as the View layer, and the Activity as the Controller layer, and the Model layer is borne by the relevant data operation class.

No3:

The MVP mode can separate the display layer and the logic layer, and they communicate through the interface to reduce coupling.

No4:

NavigationView is a real case of the MVP design pattern, and the menu analysis of the Toolbar also follows the MVP design pattern.

No5:

MVVM: Model-View-ViewModel

View and ViewModel internally interact with events through a Binder. The Binder links the View and ViewModel to the data operation part through two-way binding. When the corresponding data is updated, it is automatically fed back to the View layer.

No6:

To quickly apply MVVM in Android, the best way is to use Google's official DataBinding as a two-way binding tool, its essence is to help us realize the function of Binder in MVVM.

Configure in Module's build.gradle file

dataBinding {enabled = true}

No7:

Similarities and differences between MVC, MVP and MVVM

Bluetooth Wireless Charger

Bluetooth Charger,Wireless Charger,Wireless Speaker Mobile Phone,Portable Charger With Stand,Wireless Bluetooth Charger,10W fast charger for phone

Shenzhen Konchang Electronic Technology Co.,Ltd , https://www.konchang.com