. The construction of Web application system with four-layer architecture of net development mode

Source: Internet
Author: User
Tags abstract class definition functions implement interface sql client net access
With the rapid development of computer network technology, Web application system becomes more and more widespread. Asp. NET is Microsoft's new generation of web development platform, compared with other web development technologies, ASP. NET provides Web page level state management, server control triggers event mode, code and content separation programming, etc.

[1], to a certain extent, we have changed the architecture mode of the previous we B application system. In the aspect of software development technology, object-oriented technology and software layered structure design are some good methods of code organization. But for the concrete development platform, the multi-layer structure has different concrete performance, for the specific project development, the object-oriented technology can make the class definition and the object partition of the specific problem not the same. Therefore, how to apply the object-oriented technology to the ASP.net platform based on ASP.net, a logic clear, modular and reasonable multilayer structure of the Web application system is the content of the discussion. The author has taken part in the "Laboratory Information Management System" in the "thesis management subsystem" as an example to illustrate the design idea based on the four-tier architecture.

1 ASP. NET under Web program architecture

System Description: Students can register their own papers, can also delete their own registered papers and related all replies; Teachers and students can view, reply to the paper, or delete, modify their own responses; the administrator can view, delete all the papers and replies that are registered. The author omits the use case diagram and the use Case flow chart of the thesis management system. [2,3] only gives a timeline for modifying your own response case (see Figure 1). For the web-based application system based on ASP.net, the user is facing the client browser directly, the request of the user when using the system is passed to the server-side ASPX page through the HTTP protocol, the transaction logic processing of the user operation and the logical operation of the data are completed by the server and the database system together. According to the use classification in the system, the object which is responsible for the interaction between the system and the role is called the Boundary class object, the object that accesses the database in the system is called the entity object, the system is mediated between the boundary object and the entity object, and the object of the process in the sequence diagram is called Therefore, in the sequence diagram (see Figure 1), the Papers.aspx and the session object belong to the Boundary class object, the Users object belongs to the control class object, the reply object belongs to the entity class object.

1.1 ASP. Architecture of Web application presentation layer under Net

The presentation layer is an interface between user and software interaction, and is an html-based interface for Web programming. The primary responsibility is to provide information to users and to transfer the user's operations to the logical and data-processing tiers. From the use case event flow diagram, you can determine the number of pages used for interaction, and from the case sequence diagram, you can determine the page and server-side ASPX page relationships that are used to interact with the user. Figure 2 is the page diagram used to modify your own reply cases.

Papers (view) page to the application user to view a page of a paper, Papers (Edit) page to the application to view their replies to the page. As you can see from the case sequence diagram, they are all pages of the papers server page that are generated in two different states. To overcome the inherent limitations of the traditional Web Forms page itself stateless, ASP. NET page framework provides a view state feature that automatically preserves the page and the property values of all controls on the page between round trips, ASP. NET This feature provides a great convenience for the design of data presentation layer. Asp. NET also takes the form of how events raised by server controls work. The Web Forms Control event model requires that event information be captured at the client, and the event message is transmitted over HTTP to the server, the framework interprets the send to determine what happened, and then the appropriate method in the code to be raised in the server where the event is to be handled. The two technical asp.net frameworks above provide an abstract model that enables you to create traditional client/server Web interactions, enabling developers to use traditional methods and tools that support rapid application development (RAD) and object-oriented programming (OOP) for application programming. Therefore, the ASP.net Web presentation layer can be structured according to the event Flow graph and page diagram that the role interacts with the system:

(1) From the page diagram, determine the main functional interface used in the system.

(2) According to the characteristics of the Web control in asp.net, the defined function interface is visualized page layout:

(3) From the event flow diagram, to determine the functional pages and between the state of the transfer of the logical relationship between the page, according to the ASP.net web page level state management function and server control properties, event programming mode, writing parts of the page and between the state of the page transfer code.

In NET development tools, you can use the WYSIWYG page design tool to visualize the entire page. When you transfer logical code between these pages and between page states, you can complete the logical relationship code for the page in the Web Forms Designer Design view by modifying the object properties or writing the event.

1.2 ASP. The architecture of Web business logic layer under net

The business logic layer is the information and logic processing center of the whole Web application system, which is composed of the control object which is responsible for the sequence diagram process. The business logic layer is also the link between the Web Application system presentation layer and the data storage access layer, so the web business logic layer is very important in the architecture of the whole system. From the case sequence diagram, you can identify the control objects and the services that are required to control objects and other objects. Figure 3 is the class diagram of the users control object in the timeline of the "Modify your own reply" case. Because ASP.net provides a so-called background code that can be used to detach user interfaces and logical code, the ASP. NET itself is fully supported based on module and component development, so to support the adoption of object-oriented technology architecture Logic Layer, we can set up the Web business logic layer in asp.net from system use case diagram and sequence diagram:

(1) Most WEB application systems belong to information management system, so control objects can be divided into control classes according to the role of the system.

(2) from the case sequence diagram, determine the functions required to control the object.

(3) Adopt. NET component to wrap the functionality in the Web business logic layer so that the logical and presentation layers are physically separated.

In the. NET development tools, the "class" file can be used to implement the components in the Web business logic layer, in the project can add a reference to the "class" file into the Web project, so that the function of the web business logic layer can be used as an object in the application of web system development process.

1.3 ASP. Web data access Layer architecture under net

The data access layer is the data access interface that accesses the data storage layer as the business logic layer, whose main responsibility is to abstract encapsulate the data storage layer, so that the data storage layer can be completely transparent from the business logic layer. From the case sequence diagram, you can determine the entity object, the attributes of the entity object, and the services that the entity object needs to be provided to control the object. Figure 4 is a class diagram of the "Replys" entity object in the timeline of the "Modify your own reply" case. Point management mechanism System. The nodes are grouped according to the network characteristics of the nodes in the Peer-to-peer network, and the nodes in the packet are layered according to the transmission performance, which enhances the transmission performance of the multicast system by giving the network self-organizing and adaptive functions. In a large Peer-to-peer network, the nodes form small and medium sized multicast groups according to the grouping criteria, and the data transmission is mainly concentrated in the group. In-group management adopts dynamic centralized control, the master node grasps the global information nodes of the multicast group to dynamically adjust the position of the group through exchanging information, which optimizes the performance of the data transmission in the packet, thus strengthens the whole network performance. On the other hand, because of the grouping mechanism, the server only needs to maintain the packet information without managing all the nodes, the join, management and data transmission of the nodes are completely peer-to-peer between the nodes, which greatly reduces the burden of the server and improves the number of nodes that can be serviced. By using the node self-organizing management mechanism of node grouping and hierarchy, the position of each node in the Peer-to-peer network can be adjusted to meet the different network environment of each node in the heterogeneous network. Through dynamic adjustment within the group, the nodes with large output bandwidth are at the top of the packet, which speeds up the distribution of the data and improves the efficiency of multicast to reduce the data delay. The hybrid structure with mesh as the main body in the upper layer is greatly enhanced the robustness of the network. When the network conditions change, the entire network will be dynamically adjusted. If the exit or invalidation of the new node does not cause the forwarding path to break, the forwarding path has the ability to repair itself and optimize itself. Therefore, this node management mechanism can be applied to large file sharing, streaming media and other occasions.

In the practical application, facing the complex network environment, how to judge the network distance between nodes accurately, further strengthen the grouping algorithm and the group management algorithm, there is still much work to do, this is the key research content in the future work.

1.4 ASP. Web data storage layer architecture under net

The main function of the data storage layer is to convert data processing function into specific database or file operation. From the case sequence diagram, you can determine the properties of entity objects and entity types. Each attribute in an entity class can correspond to a field in the database, that is, each entity class can match a table in the database. Therefore, in a asp.net Web application system, you can use the System.Data.OLEDB namespace or System.Data.SQL Client. The database access and control types in the [4,5] namespace construct classes that are compatible with specific databases. Access and control of the database can be accomplished through this class in the data storage layer's access to the properties and services of the entity object.

2 Conclusion

Using the idea of four-layer architecture, and using the object characteristics of UML to design the class division, the code writing logic is clear, easy to manage and maintain, and has good code reusability, applicability, maintainability and portability. The four-tier architecture can be written by four groups of people at the same time, so that the code is maintained and managed more clearly and can shorten the development cycle. However, at the same time the four-layer code writing, need to have a good early analysis of the needs of the support. Only a complete demand analysis (for example: make the program designers know the project contains or the project needs of the class name and function name, when the project unified use, not because the name does not unify the problem of reference errors), it is possible to truly implement the four-tier architecture of concurrent design.



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.