-------------------------------------------------- ------------------------------------------- This article is original, copyright Author zxhong all, anyone needs to reprint articles, must be certified by Zxhong authorization. -------------------------------------------------- ------------------------------------------ "Design Mode" There is a definition of the framework, which is: framework is a software system design, a concept in the development process, which emphasizes the completion of the design, the reuse of the code, and one framework is mainly suitable for implementing a particular type. Software system. The framework of the four seas is not existent, such as the Struts framework is only suitable for the Web layer development of the B / S structure, and the Hibernate framework is only suitable for the long-lasting layer development of the B / S structure.
The frame should be a specific technical implementation of a certain architecture. For example, Struts is implemented by the MVC architecture. The MVC architecture is a three or N layer architecture of the performance layer, the control layer, and the physical layer. The layer is a very important concept in the framework. Especially in more complex applications, the advantage of the layer is very obvious: it can make the development process clearers, more divided into labor (the benefit of division of labor can make each developer's characteristics or advantages to play, will not be A certain developer leaving the project unable to go, the previous portrait development one person is responsible for a module, if this person leaves, then this module is to be paralyzed, this is a very terrible thing, but if you use a horizontal direction Human development, this risk is much reduced), improve development efficiency (how is the layer improves efficiency? Here I will give an example: such as the current project, business logic, persistence, and persistent layer development Since there are many things to do, you can't synchronize with the developers of the business logic layer, then the developers of the business logic layer cannot be developed? Of course, the developers who have a long-lasting layer can use the developers of the business logic. Short time defining some of the business logic layer functions may be used for some of the persistent layer data that requires a method of persistent layer development and its functions to be implemented, and the developer of the business logic layer has the names and functions of these methods. It can be developed, after the method of lasting layer is developed, it can be OK after simple debugging). This shows that the layer is a good thing, then how is the hierarchical implementation? It is said that the technical implementation of the middle layer of the frame and the technical implementation of the frame itself have to be mentioned to the surface iconic object technology and design mode. There are two parts: frame parts and specific application parts based on framework applications. To achieve the goal of the framework multiplex, you must do isolation of the frame portion and the specific application portion. One power-oriented strong function: polymorphism, you can achieve this. Complete the interaction between abstraction in the framework, associate, and give specific implementations to specific applications. The template mode (Template Method) is generally used (define the skeleton of the algorithm in an operation), and some steps are delayed into the subclass. Make the subclass without changing the structure of an algorithm to redefine certain algorithm Some specific steps. Of course, there are some other common methods, such as abstract factory modes, proxy models, etc.
The framework is often aimed at a particular application area, on the basis of deep understanding of this application, abstract the application of the application, a model of these abstract concepts, is a tangible frame. Different specific applications are implemented on the abstraction concepts in the frame according to their own characteristics, thus imparting the functionality of the framework and completes the application. A enterprise framework should: extract the commonality of different enterprise application systems to the maximum extent, reuse the completed design and code, give the best solution to the typical scenes in the enterprise application system; let a previously completed software product adaptation to adapt Multiple, complex business needs. These frameworks are often selected from a large number of project development, so they have strong universal and practicality.
Based on J2EE standards basically packaged multiple groups, using these classes, specific mutual collaboration, for some general issues, such as the form of commit, business process, log's printing, transaction processing, etc. Solution, the Struts framework is through an XML file to make a complicated business logic process at a glance. These frameworks are basically the purpose of making future development processes clearer, the division of labor during development is more clear, the coupling between the modules is smaller, the post-maintenance is easier, the development cycle is shorter, the development risk is smaller, etc.