Java Highlights (iii)--MODEL1, MODEL2, three-tier architecture with gorgeous transitions

Source: Internet
Author: User

JAVA, it is necessary to master the two architectures of Model1 and Model2. Let's look at the following together from Model1 to Model2 (MVC) and

A magnificent transition to a typical three-tier architecture.

Model1 Architecture

In simple terms, MODEL1 is implemented with JSP as its core. The JSP page responds to the client request on its own and returns the processing results to the customer, on the JSP page

business logic, service-side processing, and HTML, and so on The JSP page enables both business logic and process control to quickly open

Hair

Advantages

Simple architecture, fast development, suitable for small project development.

Disadvantages

JSP is overloaded with responsibility and violates the single principle of responsibility

JSP embedded in a large number of Java, HTML generation code that causes duplicate code too much, not easy to maintain

Not conducive to response to demand changes, high coupling and low scalability

Model2 (MVC) Architecture

Based on a series of shortcomings of MODEL1 architecture exposure, Model2 the task separation of JSP on the basis of Model1 abstraction out the control layer, will get the parameter

calls to the servlet processing, JSP is responsible for page display display. As a result, Model2 can also be understood as a simple MVC pattern.

Advantages

Clear responsibilities, more suitable for the development of large-scale projects.

Facilitates the division of labor and facilitates management

Facilitates component reuse with low coupling levels

Better response to demand changes and higher scalability

Disadvantages

Too many layers, increasing the complexity of system development

Not suitable for small project development

three-tier architecture

In the actual development process, we will find that the MODEL2 architecture also has some obvious flaws, such as the original only need to display the name and age of two letters

need to display gender information at the same time, you need to modify the business logic the code implementation of the layer violates the closure principle. In this case, we will consider

Model2 further abstraction, extracting operations from the database to the persistence logic layer implementation.

This is a very typical three-tier architecture UBD mode. u layer, jsp/servlet, mainly responsible for the foreground display;b layer, business logic layer, mainly responsible for various

Business the processing of logic; layer D: persistence layer, mainly responsible for a series of operations on the database. The three-tier architecture clearly divides the responsibilities of each layer, reducing the coupling

Flexibility of the program.

Keyword: Model1 Model2 three-tier architecture JSP Servlet

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Java Highlights (iii)--MODEL1, MODEL2, three-tier architecture with gorgeous transitions

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.