Should MVC/MVP be used? -- the house does not need to be built into the same

Source: Internet
Author: User

Many Android experts in the industry have not read this question in detail. For the architecture used in Android, a popular saying is that MVC is used. Specifically:

 

Model: Your business logic. there is basically no dispute;

View: lyout and resources xmls, andProgramSubclass of various views defined in;

Controller: Activities

 

This method immediately attracted a large number of cool-sized cows! Many people think that the activity controls the rendering and event distribution of views through the window, which is too closely associated with the view and is too coupled, so strictly speaking, the activity itself is also a view at best, some people even collectively referred activities and views to the Controller-view architecture. In any case, the rigorous MVC/MVP architecture is not implemented in the Android system.

 

For this reason, many coordinates the interaction between Android components and model, and builds a variety of beautiful villas MVC/MVP (please refer to an example: http://www.therealjoshua.com/2011/11/android-architecture-part-1-intro ).

 

Building the MVC/MVP architecture in Android development is actually an excellent practice, but we found that this architecture is rarely used in various projects, even Google's Native projects, the purpose of the MVC/MVP architecture is to better divide modules, achieve full separation of implementation and ui, and reduce coupling. This is a conceptual representation, it is not a strictly locked framework. It is at least a good practice for us to achieve the above purpose in actual development.

 

Therefore, unless necessary, it is not always necessary to build an MVC/MVP architecture in your android project. However, in any case, the model element in MVC/MVP should always keep our eyes fully rounded to 360 degrees --It is a good idea to always remind yourself to separate the model!

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.