As the business logic of Web applications gradually includes complex formula analysis and computing, decision-making support, and so on
The more overwhelmed, the business of the system is separated. Form a separate part, so that the three-layer structure is generated.
The 'lay' is a logical division.
The three-tier architecture divides the entire system into 2.1 structures [3]
(1) Presentation Layer: Contains Code , user interaction GUI, and data verification.
This layer is used to provide GUI interaction for client users. It allows users to input and edit data in the display system, and
the system provides the data verification function.
(2) Business Layer: contains the Business Rule Processing code, that is, in the Program and business
related majors algorithms , business policies, and so on. This layer is used to execute business processes and formulate business rules for data. Business Intelligence
the logic layer is mainly for business applications and provides business services for the presentation layer.
(3) Persistence Layer: contains data processing code and data storage code. Data
the data persistence layer mainly includes data access services and is responsible for communication with database management systems (such as databases.
each layer of the three layers has specific tasks in the processing program, and clearly distinguishes functions in implementation.
each layer is separated from the other layers, however, there are communication interfaces between layers.
after the three-layer software design architecture is adopted, the software system is greatly improved in terms of scalability and reusability.
while rationally designing resource allocation policies, the performance indicators of the software have also been improved, and the system security and ease of management
rationality has also been improved.
the three-tier architecture has a great impact on the software architecture of web applications and promotes the component-based design philosophy.
many implementation technologies have been developed for the Web layered framework. Compared with the two-level structure, it is more convenient to modify and maintain the three-level structure
. Currently, web application systems with B/S structure are widely used in this layer-3 architecture.
Design Pattern origin:
In 1994, Erich Gamma, Richard Helm, Ralph Johnson, and John vlissides (called the four-man bang, gof: Gang of Four) collaborated on design patterns: the basic principles of reusable object-oriented software is published as a topic book. This book explains the usefulness of the model and also makes it widely used. In the book, four of them recorded the classic 23 design patterns they found during their long-term work.
IOC Mode
The IOC mode is a code call mode proposed by Stefano mazzocchi, one of the foundons of Apach. After that, it is renamed as dependency injection (dependency injection) by martinfowlcr, that is, Class and Class, the relationship between methods is "injected" through a third party (such as a configuration file). You do not need classes or methods to resolve the call relationship between each other. IOC (inversion of control) is a design pattern used to solve the dependency, configuration, and lifecycle between components (or simple Java classes, it can solve the coupling problem between modules. In IOC mode, dependencies between components are extracted (reversed) and configured by containers. In this way, there is no code association between each component, solving the problem of the relationship between the caller and the called, and any component can be reused to the maximum extent.
Technical approaches for implementing the IOC Model
Table 2.1 lists three implementation methods of IOC. The server-side data verification component designed and implemented in this article adopts the first type of IOC implementation method.
MVC mode:
MVC is short for Model-View-control, that is, Model-View-controller. It is a server
Expression layer model, which separates applications and changes the high coupling between applications.
MVC was a software design model invented in 1980s and has been widely used in recent years.
It is recommended to be Sun's J2EE platform design model.
MVC pattern structure
The MVC mode divides an application into three parts: model, view, and controller:
1. View: displays data.
A view is the interface on which the user sees and interacts with it. The view displays the relevant data to the user and can receive the user's input data, but it does not perform any actual business processing. A view can query the service status of a model, but cannot change the model. The view can also accept data update events from the model to synchronously update the user interface.
2. Model: Application object.
A model is the main part of an application. A model represents business data and business logic. When data changes, it is responsible for notifying the view. A model can provide data for multiple views. Because the same model can be reused by multiple views, the reusability of applications is improved.
3. Controller: logic processing, controlling the display of Entity Data in the view, and calling the model to process business requests.
When a Web user clicks the submit button on the Web page to send an HTML form, the Controller receives the request, calls the corresponding model component to process the request, and then calls the corresponding view to display the data returned by the model.
MVC mode Running Mechanism
2.2 shows the MVC mode Running Mechanism:
In MVC mode, all requests submitted by web users to the server are taken over by the Controller. After receiving the request, the Controller determines which model should be called for processing. The model then processes the corresponding business logic based on the user request and returns the data; finally, the Controller calls the corresponding view to format the data returned by the model and presents it to the user through the view.
Framework
Software development is increasingly dependent on the use of frameworks. The framework can shorten the development cycle of application software systems and improve the efficiency and quality of software production. This greatly simplifies development. Selecting the framework and applying each framework to the system architecture is an important part of software architecture design.
Framework definition
In the design model, gamma and other human frameworks provide a clear definition: "framework is a group of collaborative work classes, they build a reusable design for specific types of software ".
A framework is a set of components for mutual collaboration. It can handle a series of problems in one or more problem domains. The framework emphasizes the reusability of software design and the scalability of the system. To maximize the value brought by reuse, it encapsulates the most reusable parts into various components and incorporates them into the control scope of the framework with a callback mechanism. Therefore, the Framework provides a reusable public structure that can be shared among applications.
framework features
The framework includes the following key features:
1. in terms of application, the framework is a reusable design of the entire or part of the system, represented as a method for interacting between a group of abstract components and component instances. In terms of objectives, A framework is an application skeleton that can be customized by application developers.
2. The framework is a software and a semi-finished product of applications. It can be used by system developers to complete system development.
3. The framework solves problems in a specific field. Each framework has its own target domain, which cannot meet all the needs of everyone.