MVC,MVP and MVVM in Android

Source: Internet
Author: User

Han Mengfei sha Han Yafei [email protected] yue31313 Han_meng_fei_sha

The difference between MVC,MVP,MVVM

#MVC software can be divided into three parts

    • View: User interface
    • Controller: Business logic
    • Model: Data saving

The means of communication between the sections are as follows:

    1. View Transfer command to Controller
    2. Controller needs model to change state after completion of business logic
    3. Model sends new data to view, user gets feedback

Tips: All communications are unidirectional.

MVC can be divided into two ways when #互动模式 accept user directives. One is passed to the controller through the view acceptance instruction.

The other is to accept the instructions directly through the controller.

#MVP

The MVP mode renamed Controller to presenter and changed the direction of communication.

    1. The communication between the parts is bidirectional
    2. View and model do not contact, are passed through presenter
    3. The view is very thin and does not deploy any business logic, called the "Passive View" (Passive view), without any initiative, and presenter is very thick, where all the logic is deployed.

#MVVM

The MVVM pattern renamed presenter to ViewModel, which is basically exactly the same as the MVP model.

The only difference is that it uses two-way binding (data-binding): The change of view is automatically reflected in ViewModel, and vice versa.

MVC,MVP and MVVM in Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.