Tuesday, October 19, 2010

The basic concept of MVC pattern [3]



2.3 Model

MVC from the conceptual model of the system can be divided into two categories - the internal state of the system and change the system state action. Model is all your business logic code fragment located. This article provides a business entity object model and business process objects: all the business process objects are derived from ProcessBase class subclass. Business process object encapsulates the specific processing logic, business logic is called model, and the response submitted to the appropriate View component to produce the response. Business entity objects can be described by defining the property the client form data. All business entity objects EntityBase derived subclass object, business process objects can be directly read and write it, but no longer need and request, response object data exchange. Achieved through the business entity object model of the interaction between the view and support. Realized the "what" (business processes) and the "how" (business entity) separation. This enables reuse of business logic. Since each application specific business is different, this is no longer listed the specific code examples.

ASP.NET provides a good model to achieve this classic design a similar environment. ASPX page by developers to develop user interfaces to achieve the view; controllers feature logic function code (. Cs) to achieve; model usually corresponds to the operational part of the application system. Implement this design in ASP.NET to provide a multi-layer system structure to achieve a more classic ASP system has obvious advantages for. The user display (the view) from the action (controller) in the isolated, improved code reuse. The data (model) from the actions of its operation (controller) allows you to separate the design of a data storage and back-related systems. The nature of the MVC structure is concerned, it is a solution of the coupling system problems.

3, MVC advantages

Most of the process of language use such as ASP, PHP Web application development out of the initial development of the template is the mixed layer of the data programming. For example, send the request directly to the database and displayed using HTML, development speed is often faster, but because of the separation of data pages is not very direct, making it difficult to reflect the way the business model, or reuse of the model. Flexibility in product design efforts is very small, difficult to change to meet the user demand. MVC requires application layer, although due to the extra work, but clearly structured products, product application through the model can be better reflected.

First of all, the most important thing is there should be a model of multiple views corresponding to the capacity. In the current rapid changes in user requirements, it may be several ways to access applications. For example, the order model may be the order of the system, but also on-line orders, or orders for other systems, but the treatment is the same order, that order processing is the same. By MVC design pattern, an order models and multiple views can solve the problem. This reduces code replication, reducing the amount of code maintenance, once the model changes, but also easy to maintain. Second, due to model the data returned without any display format, so these models can be directly applied to the interface to use.

Again, because an application has been separated into three layers, one layer is sometimes changed to meet the application can change. An application or business rules, business process changes to the model layer only changes in MVC.

The concept of control layer is also very effective, because it put the different models and different views together to complete various requests, therefore, the control layer can be said to include the concept of user requests permission.

Finally, it is also beneficial to software engineering management. Perform their duties due to different layers, each layer has different applications some of the same characteristics that facilitate adoption of engineering, production management tools of program code.

4, MVC deficiency

MVC deficiencies in the following areas:

(1) increase the system structure and implementation complexity. For simple interface, strictly follow the MVC, the model, view and controller separation will increase the complexity of the structure, and may produce too much of the update operation, lower operating Xiaoshuai.

(2) between the view and controller too closely connected. View and controller are separated from each other, but it does closely linked components, views, there is no controller, its application is very limited, and vice versa, thus impeding their independent reuse.

(3) view the low efficiency of the model data access. User interface based on the different models, views may be necessary to call to get enough of display data. Not change data on the frequency of unnecessary visits will also damage the operational performance.

(4) At the moment, advanced interface tool or constructor does not support the MVC pattern. MVC transform these tools to meet the needs and the cost of the establishment of separate components is very high, resulting in difficulties in using the MVC.

5, MVC design pattern of expansion

By the MVC pattern in ASP.NET prepared, with a very good scalability. It can easily achieve the following functions:







Recommended links:



Interview with B & Q (China) Vice President, Human RESOURCES Director Miss Hu Weiyan



Religion Evaluation



Automation Tools Directory



Getting Started with Corel Draw 10 (4) hands to CREATE vector graphics (1)



2009 China will reach 911 million yuan telephone payments



MKV TO WMV



Comparison of CMM and CMMI



Airgcfg.exe entry point not found repair



Of! The relationship between SEO and UCD



Tour one of the Characteristics of Flash MX



ASF to MPG



New Year 2,000,000 Administrative expenses



Qihoo 360 XIEMOSHALV download station block group



Specialist File Compression



MP4 to WMP



Encourage you Dealers



No comments:

Post a Comment