MVC (Model-View-Controller): M Refers to the logical Model, V refers to the View Model, and C refers to the Controller. A logical model M can be used for multiple view model V. For example, you can use a column chart or a pie chart V to represent a batch of statistical data. A view model V can also be used for multiple logic models. The purpose of using MVC is to separate the implementation code of M and V, so that the same program can use different forms of representation, while the purpose of C is to ensure the synchronization of M and V, once M changes, V should be updated synchronously, which is exactly the same as the Observer Pattern in design patterns.
Advantages of MVC: MVC completely separates the logic layer of the application from the interface. The biggest advantage is that the interface designer can directly participate in interface development, programmers can focus on the logic layer. Instead of handing over all the materials to the developer as before, the developer can implement the interface. The development of Android in the replices tool adopts a simpler method. The designer designs the interface in AnroidDraw and saves it in XML format. You can directly open the interface in replices to see the interface designed by the designer. The code for logic processing is placed in the src folder. Enables programmers to focus more on their business.
The interface section of Android also uses the popular MVC Framework. In Android:
1) View layer (View): it generally uses XML files to describe the interface, which can be easily introduced during use.
At the same time, it is easy to modify the later interface. The Code does not need to be modified if the id corresponding to the interface does not change in the logic, greatly enhancing the maintainability of the Code.
2) control layer (Controller): the important responsibilities of the control layer of Android usually fall on the shoulders of many acitores. This statement also implies that you should not write code in Acitivity, another reason for this is that the response time of Acitivity in Android is 5 s. If time-consuming operations are put here, programs are easily recycled.
3) Model layer: database operations and network operations should all be processed in the Model. Of course, operations such as business computing must also be placed in this layer. Is the binary data in the application.
---------------------------------------------------------