Web application model and the third part of its Java implementation

Source: Internet
Author: User

Part III: MVCD model

In the previous section, two kinds of Web application models were introduced from the general principles, but how to understand and grasp the model, it is a very practical topic to apply different Web technology correctly to different function modules of Web program. The following is the actual programming in how to master the Web programming model to do some analysis.

1, two-tier client/server model

Figure 11, two-tier client/server model

Web applications are inherently a client/server application, and when ASP (Application Service Provider) is becoming an important direction for Internet application development, it is still being explored which programming model to use to implement Web applications. Microsoft's DNA structure and Java programming architecture described above are the result of the exploration of the ASP (Application Service Provider) programming model, but because these technologies are relatively new and difficult to master, So many programmers use ASP or JSP embedded "SQL" to achieve data access and some related logic, as shown in Figure 11.

Such a programming model for some small systems is more appropriate, because do not need too complex technology, technical staff is easy to find, to achieve faster. However, the disadvantages of this programming model are obvious: maintenance difficulties, difficult to reuse, difficult to manage in large systems.

The key to solving the model problem is to abstract the logical layer. However, in the data center programming, the database not only provides the basic data access function, and with SQL rich expression ability to provide strong logical expression ability; The two models shown in Figure 9 and Figure 10 in the previous section are difficult to master, so an improved version of the model appears, as shown in Figure 12.

Figure 12, improved client/server model

Composed in the improved model, a class is established for the main tables in the database, which jsp/asp the operation of the database tables through this class. This model realizes the SQL statement encapsulation in one aspect, facilitates the maintenance of the program, and also improves the reusability of the system, that is, the reuse of the table class.

However, since most database operations are for the majority of the operations of the table, if the use of a single table to complete the logic, it is somewhat wasteful database and SQL logic functions. In addition, because the system does not realize the abstraction of logic layer, it can't solve the problem of raising the key.

2, the introduction of the MVC model

In traditional object-oriented programming, we have been exposed to the MVC model, as shown in Figure 12.

Figure 13, MVC model

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.