Research studies to develop robust enterprise-class applications on Develop Hale Enterprise Applications 1.03 version Author: shendl_s@hotmail.com
[Note: This article is my original. I also published this article at other websites. Don't misunderstand my beauty, ^ - ^]
Written in front This is 2006, I participated in a papers of the Master's thesis of Huazhong University of Science and Technology. However, this paper writes too blog and is vetoed by the mentor. I intend to rewrite a dissertation, so this air is published here. I am a master's degree in electronic information engineering, Huazhong University of Science and Technology. You can write me E-mail to contact me. The language I used is Java. The Java community is very active, at least now, can be said to be the most advanced programming language. Of course, the future, everything is not destined! Dynamic object-oriented language, such as SmallTalk, Ruby, Python, etc. also very attractive. I believe that dynamic object-oriented mechanisms should be developed and applied in the future. The dynamic agents introduced by Java1.3 have shown powerful power. SmallTalk only has several keywords, which constitute a powerful object-oriented language. Dynamic object-oriented language, no type declaration, if the actual type is consistent, directly call it! Of course, maybe this is not a shortcomings of static objective programming languages. After all, compiler errors can help us reduce errors. However, if you can simulate it when you write a code, you may also find these errors when you write a code. On June 6, I participated in the agile development symposium of Martin Fowler in Shanghai Jiaotong University. At the meeting, Martin Fowler did a speech about Ruby. Among them, connect Ruby and DSL (specific domain languages) together. He believes that Ruby's simple grammar is an ideal expression tool for the DSL language. A few days ago, I saw an article of Intellj's authors, and I also proposed the idea of developing DSL. He is committed to making Intellj into developing DSL IDE tools. Martin Fowler believes that the current XML form of DSL is too complicated and should be directly expressed in ordinary English. At present, I still think that the DSL in XML format is better. We can write an interpreter with a language such as Java to explain the custom XML form ---- DSL. The advantage of the DSL in XML format is for easy verification. In short, DSL has not yet developed mature, but future prospects is still very optimistic. However, now follow up, it may be too early. In the future, AOP will also have a lot. The mixing mechanism of AOP is the most powerful mechanism of AOP. If there is a suitable occasion in the future, it should be another killer in the hands of the programmer. I think in the future, there may be such a language: she concentrates a static object-oriented programming language and dynamic object-oriented programming language, and directly supports the program paradigm such as AOP. Although Aspectj has expanded Java. However, because it is not a standard Java, it is still difficult to use it. Of course, Java is now introducing Aspcetj into the Java standard, possibly because the AOP is still not mature, and many products and philosophy have not diverted. In the future, this language may be a future Java, or it is also a newly created language, or an extension of an object-oriented programming language. However, it doesn't matter, or the concept of Java. At that time, programmers in Java communities can also transfer to new communities ignore! At the end of this article, there is a section that "source code is design". Here, it is very similar to writing and writing articles. However, although I am published, I have written articles, so I don't have any research.
I hope that there is a programmer in this regard in the future, you can introduce articles into the world of programmers, which is also a good thing for human beings! The friends of the literature, the topic of your papers is there, ^ - ^ Ok, nonsense, please see it! 2006-06-23 in Shanghai Home
Summary of catalog ...................................................................................................................................... ........................................ ..ii1 What is an enterprise application 42 Why do we need to develop robust enterprise applications 63 What is a strong enterprise application 73.1 What is a robust enterprise application 73.2 General Structure 73.3 Surface Application of Stunning Entry - level Applications 84 How to Develop Stunning Enterprise Apply 115 Object-Oriented Programming Technology 125.1 Depending on Abstraction, not to rely on specific implementation 125.2 use delegation and not inherited 135.3 "Customer-Server" In the relationship, it should be "thin" customer class, "fat" server class 155.4 exists to provide services, rather than saved data 155.5 Method of single function 175.6 Interface 185.7 to isolate the implementation class 185.8 Designing the concept of programming language 195.9 Try to use mode to solve problems 196 Overseal programming technology 206.1 Important concept 226.2 Importance of AOP 226.3 Spring AOP Framework 276.4 How to better use AOP 287 for focus on software development 298 agile development Method of representative of the method: Prerequisite 308.2 Why is the software development process of XP 319 integration XP 329.1 Get demand 329.2 Test driver development and acceptance test level Reconstruction 339.3 Unit test driver development and unit test level Reconstruction 359.4 Summary 3610 Using Java Development Enterprise-class application reference architecture 3610.1 Javaee 3610.2 "Classic" Javaee architecture 3610.3 Java open source software 3810.4 No EJB simple Java EE architecture 3810.5 Java EE architecture using "lightweight container" 4211 summary 4511.1 "Source code is Design" 4511.2 Summary 45 Thanks 46 References 46
What is an enterprise application enterprise application (Enterprise Applications), as the name suggests, is the application that needs to be used in business operations. It is also called Enterprise Information System or Management Information Systems. Its main task is to maximize information management of enterprises using modern computers and network communication technology. Various information information is provided to managers in order to make correct decisions, and continuously improve the management level and economic benefits of enterprises. It can be said that its coverage is very wide, it is difficult to give it the next exact definition, but I can listen to some individual understanding. [1] A few examples first. Enterprise applications include payroll, patient records, delivery tracking, cost analysis, credibility assessment, insurance, supply chain, accounting, customer service, and foreign currency transactions. Enterprise-level applications do not include vehicle refueling, text processing, elevator control, chemical plant controller, telephone switches, operating systems, compilers, and video games. Enterprise-level applications generally involve persistence data. Data must last because of the multiple runs of the program, they need to be used - actually, some data must last for several years. During this time, procedures for operating these data tend to have many changes. The life cycle of these data is often longer than those that initially generate their hardware, operating system, and compiler. During this time, the structure of the data itself is generally expanded so that it can represent more new information on the basis of not affecting existing information. Even if there is a fundamental change, or the company has a new software installed, these data must be "migrated" to these new applications. Enterprise applications generally involve a large amount of data - a medium-scale system often contains 1GB of data, which exists in a millions of records. Huge data volume causes data management to become the main work and challenge of the system! Early system uses an index file system, such as IBM VSAM and ISAM. Modern systems often use a database. The database has a hierarchical database, a network database, a relational database, and an object database, and an object-relational database. The most mature, most application is the relationship database. The design and evolution of the database has made itself a new technical field. Database is an important position in enterprise applications. Selecting a database and a valid usage database of performance, which is a core job of developing an enterprise-level application! The most recently built XML file stores a small amount of data. In fact, the XML file format is an early level database. It has rich ability to express its ability and simple advantages, but the history of database development has shown that XML files are impossible to replace the current relationship database and object-relational database. Enterprise applications generally involve many people access data at the same time. For many systems, the number may be less than 100, but for some web-based systems, the number will increase in an exponential level. To ensure that these people can access data correctly, there will be such or such problems. Even if there is not so much, it is also a problem when two people do not have errors when they operate at the same time. The transaction management tool can handle this problem, but the most programmers, we still have to use them correctly, which is also not easy to do. Enterprise applications also involve a large number of user interfaces. Hundreds of user interfaces are not surprising. The frequency of users is very different, and they often have no technical background. Therefore, for different purposes, data requires many ways. Enterprise applications are rarely existed, usually need to integrate with enterprise partners. These a wide range of systems are developed in different periods and using different technologies.
Even communication mechanisms are different: Socket-based systems, CORBA systems, COM systems, Java RMI, EJB, and message systems, and the latest Web Service, etc. Enterprises often want to be able to integrate all systems with a one-time communication technology. However, every time this integration is difficult to really realize, and the left is a integrated environment of different styles. Even a company unified integration technology, they will still encounter differences in business, and the inconsistency of data concepts in the database. Different departments, different systems, even different periods, will have different definitions and understandings for business data. With the development and integration of enterprise applications, the enterprise-class application of the entire enterprise has become a complex system that is complicated together with different technologies. Constantly modifying and adding new features, making the system's bugs more and more, modifications, and add new features become more difficult. For some people, the term "enterprise application" refers to a large system. But pay attention, not all enterprise applications are large, although they may have a huge value for companies. Why do we need to develop robust enterprise applications that develop enterprise-level applications is not a simple thing, developing an enterprise application that can satisfy customers is more important. This requires too much things to overcome too much difficulties - technology, business, interpersonal relationships. In fact, the main costs and difficulties of enterprise-level applications are not developing software during this period, but in the maintenance phase of the software. Enterprise applications After their delivery, its maintenance phase accounts for large specific gravages in software lifecycle or survival, and there are 50-70% of the total cost of software life cycle (TCO). Because the business environment of the company has been in constant changes, this requires enterprise applications to adapt to the changes in the company. And these possible changes are difficult to foresee it for developers. If the development of the enterprise application, its architecture is not strong, not strong enough, then modify the software in the maintenance phase, or adding new features will be extremely difficult, even can't do, you must push down! The changes in business needs are the biggest risks and difficulties in enterprise applications! Moreover, this change, basically each project will appear, which is "normal" development in enterprise applications. Even, in the process of software development, there will be changes in business needs. Now, there are many enterprise applications, such as ERP, CRM, financial software, etc. Many companies have spent a big price to buy back, but there is a lot of cases that fail. Not only causing waste of software purchases, but more serious is to disturb the normal business activities of the company, causing serious losses. Many companies are also despising information about information. Enterprises, as the main body of the market economy, the inside and external environment in which it faces continuously, and the company itself will also adjust its organizational structure and business processes. There is no set of unharitable organizational structures and processing processes suitable for all companies. Using the set software, it is a good ratio to be "cut enough". In order to adapt to the needs of the software, change the company's original organizational structure and business processes, it is really unhappy. Enterprise-class applications are serving business services, should obey the needs of the company, rather than the opposite, enterprises become slaves of software! IBM's advertising word "The software that should be changed" is the ideal software for enterprise applications. However, can it develop "Software that should be changed" in terms of IBM? Of course, it is impossible, everything can only be done by our programmer!
What is a robust enterprise application What is a robust enterprise application "The software that should be changed", it is like plastic mud, we can arbitrarily take pin, change different shapes. "Software that should be strained" is inevitable to be strong, no matter how tossible, it can be able to deal with it. What is "robust enterprise application", I can't give a precise definition, I can only list some of my understanding. "Army Enterprise Application", its various parts should be low coupling, high cohesion. The relationship between the individual modules thereof is the lowest, and can be replaced with each other, so that each module can be easily disassembled, replaced and modified. Its core thinking is "interface". Between the ports and cooperate together with each other through the interface. As long as the interface is the same, then these modules can be replaced with each other. For other modules, the specific implementation of its partnership part is not important. Thus, when we need to change the software with "Cable", we can simply provide different implementation modules on the original system. This is actually an embodiment of object-oriented (oo) ideas. More deeper, it is "abstract" ideas. Block the specific source code through the interface, abstract. In this way, as long as the interface does not change, no matter how the source code changes, it will not affect the normal operation of the entire software. Of course, not only enterprise applications need "robust", any software should be strong. However, during the development and maintenance of enterprise applications, due to the variability of its needs, it is more necessary to "robust". The general structure of enterprise-level applications now, let us look at the structure of enterprise applications. Enterprise-level applications are structurally, can generally be divided into three major modules: performance modules, business modules, domain modules. Here, I call them "module" instead of "layer". Many people like to divide "hierarchy", but I think "module" is more appropriate. Because, "layer" has up and down, it can only be the upper layer to call the lower layer; "Module" does not have up and down, and can be called according to the actual situation. Here, I don't want to distinguish what is the upper layer, what is the next layer, using the module to indicate that it should be more appropriate. First, the representation module representation module, is also called the client. Used to provide customers with a way to use a software system. Generally there is a graphical user interface GUI, command line interface, text file, and more. This module is just the method used to receive user requests, and then delegate this request to the business module (this is the service provided by the business module), thereby implementing the software function. The quality of a software has no direct relationship with it. Second, the business module business module, encapsulated a method of providing services for specific business needs. The performance module is to achieve business needs through the methods provided. Therefore, the business module is the key and most important part of the system directly corresponding to the system. Third, the area module may ask: Since the business module has provided the function required by the customer, then what is the module of this field? In fact, this field module is a more underlying function for business module services. In the entire software system, there are some entities. These entities contain some data and responsibilities, their interaction collaboration, can implement the business function of the software system. A business module that implements a business requirement may require one or more of these entities. The collection of these entities is the domain module. It can be seen that the domain module is actually the core and soul of the entire system. The business module is only entrusting them to provide the business features required for the system. The general structural and robust enterprise application of robust enterprise application, what should it be in the structure? First, the performance module representation module is just an interface that provides users with the use of the system.
Therefore, as "thin" performance modules is the ideal performance module. "Thin" performance module can be easily changed when the user wants to change the user interface. Changing the user interface is the most demand for system changes. The performance module designed using the MVC mode can be divided into 3 components: M (Model) model, V (View) view, C (Control) controller. Among them, the model is some classes, and they encapsulate data to be presented to the user, and is also used to pass the user operation information to the background controller module. The view is the user interface, which is the part you see. It can accept the user's request and send the request information to the controller, and then obtain data from the model class after the controller completes the operation, exhibits to the user. The controller, after receiving the user request, complete the service function on the service object of the business service object of the business module. If there is a data that needs to be returned to the user, store the data into the Model model class to use it. The controller, although it is part of the performance layer. However, it is actually an application of "business representative mode". The so-called business representative refers to a "representative layer" between the client and the business service layer, and all clients to the server are called, "delegate". [9] The business representative although it is within the expansion module, it is actually the task of calling the functional service module function, and is the business function. Therefore, many people divide the business representative within the business module. I also agree with this division. At least, we can think that it is a part across the performance module and the business module. In the expansion module, both the models and views are usually small, and they are inherent, they cannot be omitted, it is enough "thick" (for example, client technology), there is no way to become smaller. In fact, we say that the performance module of enterprise-level applications is too "thick", which refers to the "thick" controller. The ideal controller should only call the different service services of the business module according to the different requests on the received interface, complete these requests, and then post the resulting data into the Model model class. The mistakes we often make, that is, in the controller, there are too many code in the business service class that should be placed in the business module. In fact, the determination controller is not too thick, there is a very simple method: Suppose we use another performance module technology, then how many code and existing controller in this new performance module It is repeated. If there is a duplication code, use "Reconstruction" technology, first extract them into methods, then move to the business service class of the business module. In this way, we can get an ideal "thin" performance module! Second, the business module business module, including 2 parts: one is a controller of the expression module, which is "business agent", providing services related to business. I think it is more appropriate to divide it in the business module. The other is a business service module, I use service to indicate it, it encapsulates a method of providing services for a particular business requirement. It cooperates with the controller to complete the business functions required by the user. Since the ideal controller is "thin", all repetition code is moved to the business service module. Then, the ideal business service module is inevitably "fat". In fact, the controller and business service module are typical "Customer-Server Mode". As a customer, the controller needs to call the service provided by the server's business service module to complete the user needs.
Therefore, the more the server is getting fat, the more services are provided, the less the system's repetitive code, the more powerful functions! Third, the domain module business service module and domain module is actually a typical "customer-server mode". Although the service service module is powerful, it is very "fat". However, its "fat" is also limited! Its "fat" comes from the controller's repetition code that should be jurisdiction. In fact, in the "Controller Module-Business Service Module", in the "Customer-Server" relationship, the controller module "thin", and the business service module "fat". In the "Business Service Module - Domain Module", it is "thin" as a "customer" business service module as a "customer", and as a "server" domain module "fat". The domain module, mainly the domain model (also called business objects bussiness object). The domain model, encapsulates the data of the business entity, and provides some services to process these data ("Services" in the programming language is provided by the method). Generally, in enterprise applications, some domain models require persistence storage, which is to save to the database (relational database or object database), text file, XML file, serialization file, etc., it has been prepared use. At this time, it is necessary to persistent business objects that require the corresponding provision of data access services (also called DAO, Data Access Object Data Access Object). In this way, the general enterprise-class application domain module has two modules: domain model (Domain Model) and Data Access Service Module (DAO). In the "Business Service Module - Domain Module", you should move all of the business service modules all can be moved to the domain model class and data access service class in the domain model class and data access service class in the domain model class and Data Access Service Class is going. Because of the service module of the service module, the relationship between the domain model and the domain module of the domain module and the data access service module is "multi-to-many" relationship. A business module can use zero or multiple domain modules; one domain module can also be called by zero or multiple business modules! Therefore, the more "fat", the more "fat", the more services provided, the less the business module, the more powerful, the system is more powerful! Now, many programmers have accepted the idea of UML's use case driver development. It is true that the use of example-driven development is really good, but many programmers have committed a problem: they often submit a sub-package subcontract (which is the package, .net in Java), error The domain model of the domain module, the DAO data access the service class and the service module controller, and the business service class is divided into a package. In fact, the domain module and the business module are completely different, and they are not from a certain case, but belong to the entire system, which can be used together by multiple business modules. If the domain module is placed in their business modules for the first time. Then we are very difficult to use them when we call them in other business modules. Because of the use of other business modules, the domain model classes and DAO classes may be required to add new fields and methods. In the bag where they are located in another business module, we are difficult to put these new features into the domain model class and DAO classes, making them more "fat". It will tend to increase the method in the controller class and business service class. This will cause duplication of code in each business module, and logical repetitions can occur. How to develop robust enterprise-level applications, according to whether it is possible to be able to divide, can be divided into two categories: robust and fragile. Draw a plurality of axes, I am called "Software Health".
"Stunning" in the positive direction, "fragile" in negative direction. There are many technical principles and development methods that allow our applications more robust, and violates these principles and methods, our applications will become more vulnerable, modified, and new features are also more difficult. To develop a strong enterprise application, the first needs is the solid programming skills of developers and the clear understanding and application of programming principles. There is no high level of developer, and it is meaningless to "robust enterprise application". Object-Oriented Programming Technology Object-Oriented Programming Technology (OOP, Object-Oriented Programming) is the greatest achievement in the field of programming in recent decades. A robust enterprise app, even any robust software, must first be a good software that practices OO thought. If you are out of OO, you don't have to talk about any qualified software! Object-oriented programming technology has long been gone from the past. Today, any mainstream programming language is supported object-oriented programming. Now, almost all programmers claim to have mastered object-oriented programming. However, the programs that truly master OO are far from so much. Moreover, the object-oriented programming technology is still in the process of rapid development, we have not discovered its entire connotation. It is not to say that you use the object-oriented programming language development software, you can develop software practicing OO ideas. To develop a robust enterprise application, we need to fully convert to oo! Several principles for object-oriented programming [2]: Depending on abstraction, do not depend on the specific implementation, depending on the interface (Interface) Not to rely on the specific implementation of the interface. Or, depending on the parent class (preferably abstract), not a specifically implemented subclass. Or, depending on the parent interface, not a sub-interface. In summary, only the most basic types of the required methods are provided. In this way, when the program needs to change, we can only provide another "server" to implement classes or implement subclasses, and then replace this new implementation class in the "Customer Class" new instance, no need to replace "customer class" Call code. When using the IOC (reverse control) container, such as a Spring framework, we can even do any code to change the "customer class", and simply change the metadata (in the Spring Framework, it is a simple XML file), the old Implementation class name is new. The more you use the abstract interface or class, the more you can choose! We know that there are several scopes in the Java language: private, protected, Package package, public public. According to the principle of "Depending on Interface", we have a new role: Publish has been released. The method declared in Interface Interface is published. Since we are now using implementation classes, then, even if there are other public visible methods, we don't call them even if there are other public visible methods. For example, the A class implements the B and C interfaces. Call the Class A customer code, B b = new a (); this call, then we can only call the B interface publishing (Publish) code, this is not due to the negligence of the programmer There creates unnecessary coupling of code. If you need to change the implementation of the B interface, assume that the D class implements the B interface, just change it in the customer code: B b = new d (); it is possible. Of course, there are always exceptions to everything.
For classes that are particularly simple, we don't have a change in the class, we can also use the implementation class directly instead of the interface. Such as: The Model model class in the layer MVC mode, there is also a field model class, which is mainly providing data, only a few ways (SET / GET method is not counted), and does not change often, so we use them directly. Not using the interface. Use the delegation and not inherited to make a class implement some functions, there are three ways: 1. Write the code directly on the class. 2, use inheritance. Let the class inherit another class so that all public and protected methods of another class can be used. 3, use the delegation. In a class, by defining instance variables of the object type, the methods of those objects can be invoked to provide functions. There is also a special way of use - "Tonance Mode". That is to declare the parameters of the object type in the method, then call the method of this parameter to provide functions. At the time of use, the customer class needs to provide an instance of an object as a parameter to this class. In these three methods, for special features without existing code, we can use the method of writing directly to implement functionality directly. When there is a class that has the method you can use, we can use the method of inheritance or delegation to use them. If we use inherited to get functions, then we will get a lot of parent class fields and features that may not need. Such redundancy will cause logically confusion. Moreover, Java can only perform single inheritance, ie, a class can only inherit a parent class. In this way, once inherited a class, it deprives it over the ability of its inheritance. Maybe you will ask, why is Java to cancel more? Because, the benefits offered by inheritance are far more than what it causes. What should I do if the field of the 2 parent class is the same name? And, it is logically caused great chaos. Inheriting things that can do, they can do it. And do better! We can delegate the required tasks to any class (don't forget, you should try to use the interface interface, preferably the IOC container), and then in the way the service is provided, the method of delegate object is implemented. This way, logically, we can achieve the functions required by these classes without achieving unwanted fields and methods. Therefore, we should keep in mind the principle of "use delegation and not inherit". Of course, there is still an occasion that "inheritance" can be used. 1. A class and another class is a pure extended relationship, and there is no place to logically. Such as, geometric and square classes. Of course, in this case, the use delegation is still available, and more insurance is more insurance. Because, there is often a lot of classes that look very much like the father and son, which is actually not a real father and child relationship. The parent class may have several subclasses to have a method, which will become a timed bomb that triggers problems when we need to add relevant methods to children. 2, template method mode (Template Method) [3] Applicable. When you know how to implement a workflow, don't know how all a single step is implemented, using a template method mode is relatively simple. [4] Provides a workflow method in the parent class (usually an abstract class), and then provide a number of abstract method of the method that needs to be used. Subclasses only need to cover these abstraction methods, they can provide different implementation effects. This usage is also called "polymorphism". However, even if this is the case, the delegation is still competent, and more flexible than the solution provided by inheritance is more flexible, just a little more complicated. This is the Strategy Policy Mode [3]. The strategy mode will be concentrated in an interface.
Implement the specific function with the implementation class of the interface. "Depending on abstraction, do not rely on specific implementation" and "Use Delegate and not inherited" these two principles: do not provide unwanted capabilities for classes. As long as it is ingenious enough. When communicating with other classes, only the service that is constructed is used. Only in this way can it guarantee that all classes that meet the interfaces can be replaced with other implementations. In the "customer-server" relationship, it should be "thin" customer class, "fat" server class in the use of delegated classes. The delegated class is the "customer" class, the delegated class, is the "server" class (also called it "Assistant"). In such a pair of relationships, we should try to give the customer class "to lose weight" to the server class. Because, in "Customer-Server" relationships, customers and server classes are generally "multiple-to-many" relationships. A gainful server class can provide better services to more customer classes in the future, and the code that will be repeated in the customer class will disappear. This principle is to deal with the relationship between the two classes in "Delegate". The meaning of the class is to provide services, not the saved data for classes, what is the most important thing, there is always a controversy: Some think that the meaning of the class is the data of the package, some believe that the meaning of the class is The service provided (that is, method). I agree with the latter. The meaning of the class is to provide services through ways. The data stored data also needs to be exposed through the SET / GET method. We all know such a classic formula: data algorithm = program. The class is a module that simultaneously encapsulates the data and its related algorithms. Or the module of the algorithm and the data it use. Method, it is a concept that appears very early, in the process of programming the era, is a core concept, is the most important abstract mechanism at that time, it appears, so that we have the first time to block the specific implementation code shielded ability. Method, a point execution is provided. In terms of aspect programming (AOP), it is called "JOINT". We can intercept before and after the method call, add additional code. This is the viewing idea of AOP, which will explain in detail below. In addition, when the client code calls the method, only the method name and parameters need to be given, and the implementation of the method is required, which gives the "Customer-Server" to release the coupling a chance. The internal implementation of the method can be arbitrarily changed as long as the method is not changed. In OOP, we can also use another method of this interface to implement a version to provide different services. We know that the class is a collection of data and methods. In fact, from the perspective of using an example-driven development, it is a class package, and then the service needs to be encapsulated, and the data is also encapsulated in the class. The way I write classes is the way "Customer-Server". Use the delegation, that is, the "customer-server" method is used to program. First, it is the use case provided by the user (called "user story" in XP). But use cases are too broad, not enough to support programming work. Thus, the user then provides the specific event stream of each use case. In XP, it is to provide an acceptance test, and an event stream is also included in the acceptance test. The event stream is to drive the first "customer" we developed. Understand the event stream, we can draw a sequence diagram of the UML. The sequence diagram describes which services are provided with the system's business module to complete the event stream. We can write the logic of the sequence diagram into a controller class directly. The controller is the first "customer" in our source code. It consists of "Customer-Server" relationships and the service service service class, which may also form a "customer-server" relationship with the domain model class of the domain module. In the "Customer" in the controller class, we have implemented the entire event stream.
However, there are many services to be called (that is, the method, whether it is the method of the class, the controller's own method, the method of the Service service class or method, etc.) has not been implemented. Assign these services according to logic and whether it will be repeated to the standard in the client, assigned to each class of each module. Divide these services into each interface in accordance with the principle of "interface" programming, not the class. Now, although the program has not been developed yet, we already know that the program has been logically complete, or, it has been designed. We only have two simple implementation levels to do: 1. Write services to implement code; 2. Use reconstruction to move these methods to the most suitable interface and implement the class. "Service" is what we need. We use methods to achieve services. Methods may require some variables to save status, where some states need to be saved using instance variables. This more! Reconstructing, in fact, the total ideas are also trying to eliminate variables, especially example variables; try to extract methods without using variables. Because the variable is "implementation" level, it is a direct source code, which is dead, not allowed. The method is "design" level, is alive, as long as the method signing does not change, the internal implementation code can be arbitrarily changed. Moreover, the variable is not a "program execution point", and it is not possible to intercept, and the method can intercept, such as an aspect programming, or interception of the proxy mode, decorator mode. According to the proportion of methods and data, the class can be divided into three types: only the data and GET / SET method's dumb container class, existing data has a general class of the actual method, only the method without instance variables. 1. Only data and GET / SET methods are only data containers. Martin Fowler calls them as "infant" [5]. As a starting point, it is possible, but it is not mature. Even, it is difficult for us to think that they are truly objective. However, in reality, there are still many such classes. For example, the Model model in the performance module of the MVC mode. Its task is to package data to customers. Also, the domain model of the domain module, which encapsulates the data of the business entity. However, we can package some methods that use this data internally. In short, encountering this type of dumb container that only data and GET / SET methods, please pay special attention to whether it is able to reconstruct it, let it become a normal class. 2, only the method without instance variables is due to the method of programming the world's first citizen, so this type of class is normal, healthy, is still very common in the real world. These classes provide services, but the service implements code does not need to save the instance variable. Like a performance module (may say that it is a business module more appropriate), the service module's service service service class, the domain module's DAO data access service class is a class of this type. These classes have a advantage, that is, they are not afraid of multi-threaded applications. Because they don't need to save threaded data. So, we can use them using them. That is, in the entire application, only one instance of these classes is generated, which is used to serve all users. A servlet is single in Javaee's web container. Spring framework management class, you can also use single example. The method of single functionality is in the object-oriented development method, and the interface, class, method need to correspond to a single logical concept. Implementing this principle, you can make the interface, classes, and methods, the block is small, the relationship is simple, and the logic is clear.
A large goal of reconstruction is to compile a large method to a plurality of small single liability methods. Single liability methods, many of them are the results of reconstruction. The delegation of OO is actually a way to delegate other classes to provide services. Excellent OO software is a method of delegating other classes (as a "server" class) to provide functions. The characteristics of its code are that a method is called internally to implement functionality, and the names of these methods explain their functions. Then, these calling methods are called in this way. The loop is not until the bottom of the optimal "server" is a way to call the API class library and end. A single responsibility interface is a design logic concept, there should be only one interface to provide corresponding logic. This principle is the principle of cohesiveness of the class: functional relevance between a module constituent elements. Robert C. Martin linked the cohesiveness and the role of a module or class change. [2] "In a case, there should be only one reason that caused it." The interface is also a class. Therefore, we can say "For an interface, there should be only one reason that caused it". In fact, an implementation class is hard to do "there is only one reason that caused it". The concept of this pure design level of the interface is different. It can truly "there is only one reason why it causes it". Even if an implementation class can "only one reason why it causes it", it may also cause a problem that the class is too small, too many. The interface only contains the method signature and does not implement the code, so there is no problem even if there is a large number of interfaces. Responsibilities is "Causes of Changes". If you can think of more than one motive to change a class or interface, then this class or interface has more responsibilities. So why do you want to classify two responsibilities to two separate interfaces? Because every responsibility is a variable axis. This change is reflected as changes in the responsibility of the interface when business needs changes. If an interface has a redundant responsibility, there will be multiple reasons that cause it. If an interface is too duty, it is equal to coupling these duties together. A change in responsibility may cause the ability of the interface to complete other duties to be weakened. For example, a business service module of a business module has two types of business services, and a class is to provide services to the design of model data in the field of deletion, and the other is to determine the data integrity and correctness. Then, these services need to be stored in two different business service service service interfaces, respectively. In this way, in demand changes, we can change only one interface when the service changes, and the other interface and all its customer classes will not be affected. Use the interface to isolate the logical concepts in the class, and there should be only one interface to provide corresponding logic. In reality, our implementation may not be so pure, probable, our implementation class simultaneously implements a lot of interfaces, such an implementation class, called "mixed class". But this doesn't matter because this is just a "implementation" level issue. We still have a pure interface, when we use this implementation class, it is used through the interface. In this way, the method of other interfaces implemented by the mixed class, we will not use it, and it is not available. Any implementation class of the interface is not related to the "customer" call code! Directly use the concept of programming language to design software development truly improvement depends on programming technology, and this again means advancement of programming languages. C is such a progress. It has achieved explosive popularity because it is a mainstream programming language that directly supports better software design. C takes a step in the correct direction, but it also needs a greater progress. [6] Java is such a more advanced, more object-oriented language than C . Java can more efficiently support software design.
When we are designing software design, we should use the concept of Java to describe the software system directly to design. In this way, we can directly convert the design into achievements. Since we advocate "Programming" for Interface, we should mainly use the "interface" concept to describe the system. In addition, since we pay more attention to "service", it is the method, then we use methods, not data to describe the interface. XP proposed CRC chart (Class, Responsibilities, Collaboration class, responsibility, inter-class relationship) is very in line with our requirements [7]. CRC diagram, describing a class, usually describing an interface interface here. The responsibility is to serve, that is, the method. It is the inherent requirement of the interface and is the reason for the interface. Inter-class relationship is the relationship between interfaces and other interfaces. The interfaces can be collapsed to complete business functions. In carrying out software design, we do not consider the details of the specific implementation of the design. We only need to consider interfaces to provide those services, and which interface collaborate, how to collaborate. Try to use the model to solve the problem of the problem, you know: not to solve any problems, you have to start with your head. They are more willing to reuse the previous solution. When you find a good solution, they will use them over and over again. These experiences are part of their way. Therefore, you will see repetitive modes of classes and mutual communication in many object-oriented systems. These patterns solve specific design problems, making the object-oriented design more flexible, elegant, and final reuse. They help designers put new design based on past work. Take the previous successful design. A designer familiar with these modes does not need to discover them again, and they can immediately apply them in design issues. [3] The definition below "Mode" is this: Since 1994, the GOF's epoch-style famous "design mode - can be used for object-oriented software foundation", the programmer world has caused an uproar. Many models have been launched, involving various fields. Among them, Martin Fowler's "Analytical Object Model" and "Enterprise Application Schema Mode", and "J2EE Core Model" written in the Sun Java center are of the top one. There are also many model works in a particular field. They collect some modes in a particular field. Today, browse these model books, we can get a lot of expert-level solutions and experience. In fact, using the model to solve the problem, do not need you to study a variety of modes, just need to know how they use it, you can think of where you should find the corresponding mode when you encounter such problems. Mode, just as a dictionary. However, "Design Mode - can be used for object-oriented software" This book should also be carefully studied. Because 23 patterns in this book are the most important, the most widely used mode. Of course, everything is not too much, too can't! Now, some programmers are in the pattern of the square, and there is an inventive mode. We should notice that using models to solve problems, usually increase the complexity of software. Originally, a class solved problem now requires several class collaborations to solve. Therefore, for the obvious simple function, complicated mode is not suitable. In addition, there is not much mode in one software. Otherwise, there will be a large number of relationships between classes and classes, so that the system is too complicated.
Aspects of programming technology is a new programming paradigm for 1996 Gregor Kiczales in Parc 1996. AOP is a way to look at the application structure with OOP, according to the concept of AOP, the system is decomposed into aspects (aspect) instead of objects. OOP is a successful, highly expressive programming paradigm, and many field concepts can be naturally expressed as objects, thereby modularize the code in which it is. However, there is still a corner that OOP can't take care of it. Measuring the standard of OOP Success is how to avoid code repetitions. The code repeat is the worst code odor. As long as you have a repetitive code, you must have a serious problem - or have a problem, or there is a problem. In general, OOP can avoid code repetition. Specific inheritance can help us share the same behavior between different types; polymorphism allows us to handle different types of objects in the same way, focusing on their common situations. And delegate, constitutes a "customer-server" relationship between the class. Customer class code Simple call server class can complete numerous functions "delegation". However, sometimes we can't use OOP to avoid code repeating, or you cannot get an elegant solution with OOP. Let's take a log record. Suppose we have logged logging for each method of each controller class. Then, use the OOP delegated programming style, which is to use the "Customer-Server" call mode. We need to increase the code that calls the log log record in each method of each of the controller classes of the software. Although the OOP delegate has been well received by the log log in the LOG class as a "server class", as the "Customer-Server" call mode, it is always impossible to remove the code of the service to call the server in the customer class. If many "customer classes" need to call "Server Class" "Service", the calling code in the "Customer Class" will inevitably have a lot of repetition. This is the "customer-server" such customer main adjustment mode inevitable drawbacks. Of course, honestly said that the repeated calling code in such "customer classes" is not a big deal. Software that exists these duplicate code can be a more robust software. This is why I use OOP object-oriented programming technology as the first technology for developing effective software. However, today, AOP-oriented programming provides another call mode, allowing customer classes to get the required functionality! In this way, repetition code is completely eliminated. AOP's call mode is the Hollywood principle: "Don't try to contact us, we will notify you at all." This is completely different from the OOP delegated "customer-server" call mode. In OOP, if a class (customer class) requires another class (server class) to provide services, you need to explicitly add calling code in the customer class's source code. In AOP's Hollywood Principles, if a class (customer class) requires another class (server class), you do not need to make any claims in the customer class. Instead, specify which customer classes you need to provide the service. Make a class ratio in our real life: I need to take a taxi, then I need to call the taxi company to call the "service". This is the working principle of the "Customer-Server" call scheme delegated by the OOP. Taxi companies provide specialized taxi services, and customers only need to simply call their services. Or, I am walking on the road, throwing a waste paper anywhere. Then, the cleaning union will take this waste paper away. Here, I didn't take the initiative to ask the cleaning worker to provide services, but the cleansing workers he served for me. Or, I am walking on the road a day.
However, this road is not my built, and it has nothing to do with me. Cleaning the garbage, repair road, bridge, is actually a service provided by the government, or is called "infrastructure", whether tangible infrastructure, or invisible infrastructure. The government provides "infrastructure" (such as: cleaning garbage, maintenance road, etc.), and the principle of AOP's "Hollywood Principle" is consistent. I called "Hollywood Principles" as "customer-infrastructure" call mode. "Customer" is a class that actually needs service. "Infrastructure" is a class that packages and providing services (aspectj supports "aspect, called" aspect ", and in an AOP framework like SpringAo, or with a general class "infrastructure"). "Customer-Infrastructure" call mode is "infrastructure" to act on "customers". "Customer" does not know how to have "infrastructure"! Infrastructure, it is divided into two parts: which methods for the package service and which method services specify which client classs are served. The important concept of AOP first, let us clarify the definition of important concepts in AOP. Since AOP has a lot of time, and there are many geography, there are many different versions in these concepts. [8] 1. Concerne (Concern) A focus can make a specific problem, concept, or interest section of the application. Or, it is the expectation of "involving" on the application. The people are related to those related to procedures, such as customers, programmers, related systems, clients such as applications such as applications. All in all, it is a target that the application must reach. Logs, security, transaction management, performance requirements, user management, role management, role authorization management, etc. are common "attention" in the system. In an OO application, attention may have been modularly modular, or it may also be scattered in the entire object model. In fact, "Focus" is not a unique concept of AOP, which should be a concept that the application has. It is similar to "use case" in an object-oriented UML diagram, or "story" of XP. Second, crosscuting convern) If a focus on the code is scattered in many class or methods (such as: log, security check), we call it "cross-cut". If you use OOP to achieve cross-cut concerns, then you will inevitably cause call code repeat. If we use the AOP to achieve cross-cut concerns, you can make any code calls in the customer class. Crossing concern, is the land of AOP. Third, aspect is a modularity of a cross-cut concern, which will be scattered throughout the place, used to achieve this payment code regulation to one place. It typically includes two modules: modules for encapsulation service codes and which methods for which client classes are specified for which client classes are available. Fourth, a point in the process of the Join Point program. Such as: 1, method call: Method (possibly comprising a constructor) call, but not all AOP frameworks support enhancements in an object construct. This is the most important, most common connection point. We have said in object-oriented programming technology, a major means and goal of reconstruction is to construct a large number of methods. Because the method is a connection point, it is an abstraction, we can use the method of this layer of abstraction, any implementation code within any modification method. So, in our code, we should have a large number of ways this blue point.
Even if we don't, we can also reconstruct it when applying AOP programming, and reject a method in the need to intercepted, come as a connection point! Some AOP implementations, such as JBoss AOP, only provide ways to call this connection point. 2, field access (Field Access) read or realize the example variable. Similarly, not all AOP frameworks support enhancements to field access. Those supports such enhanced AOP frameworks can distinguish between read operations and write operations. Spring AOP, JBoss AOP does not support field interception. Field interception is a potential danger, which violates OO package principles. In general, I think it is best not to use field enhancements. Access to fields in the OO program, can be replaced by methods such as the SET / GET property. AOP interception of fields, typically, can also be replaced by enhancements of the method level, thereby maintaining an object's package. 3, abnormal throws (throws) specific exceptions are thrown. The JBoss AOP framework only supports method calls. However, it is still possible to obtain an abnormality by programming. In fact, the abnormality throws this connection point, which is the derivative of this connection point. Ability to intercept the method, then you can intercept the abnormality thrown. V. Submids, this term has many translations, and Luo Shi flies in the book of "Proficient Spring": "Equipment"; Spring Chinese Forum translated in "Spring Framework Development Reference Manual" Notice, Stone 1楹 Translated "Enhancements" in the "Expert One-to-One J2EE Development". Here, I will call it "enhanced"! Enhanced, is actions performed at a specific connection point. Many AOP frameworks are enhanced in the form of interceptor - the so-called interceptor is an object: When the connection point is called, it receives a callback message. Examples of enhancements include: 1, check the security credentials before allowing the connection point. Such as an affiliated open source project Acegi of the Spring framework is a project that uses the Spring AOP intercept method. 2, turn on the transaction before performing a method connection point, submit or roll back the transaction after the connection point is executed. The Spring AOP framework provides this feature. 6. Pointcut (Pointcut) A set of connection points, which is used to specify when an enhancement should be called. The entry point is commonly used for regular expressions or other wildcard syntax. Some AOP implementations also support the combination of entry points. Plus points plus enhancements is a complete aspect, or called "infrastructure". It can achieve cross-cut concerns. 7. Introduction is translated as "mixed". Refers to an existing class or interface to add a method or field. This technique is used to implement many of Java, or add new APIs to existing object models. For example, an interface can be implemented by introducing an existing object. 8. Mixin Inheritance) A "mixed class" encapsulates a set of functions, which can be "mixed" to existing classes, and there is no need to help traditional inheritance means. In AOP, it is achieved by introduction. In Java language, multiple inheritance can be achieved by mixing. Nine, weaving will integrate aspect to a complete implementation process (or complete class, which is introduced). This is the implementation mechanism of AOP. Aspectj is the use of the precompiler, which is woven by generating code before compiling, which is called "static woven". The AOP framework such as Spring AOP is woven in a manner that generates anonymous objects of anonymous classes at runtime. This is called "dynamic weaving".
Ten, interceptor) Many AOP frameworks (such as Spring and JBoss 4, but do not include AspectJ) to intercept the fields and methods. Then, the connection point (such as method interception) is attached to an interceptor chain, and each interceptor on the chain usually calls the next interceptor. In fact, intercept is an AOP implementation strategy, not the core concept of AOP. XI, AOP Proxy AOP Framework Object, this anonymous anonymous object, which is a notification of the target object to complete the target object, and also woven into the notification of intercepting connection points. In Spring AOP, the AOP agent can be a JDK dynamic agent or a CGLIB agent. AOP proxy is not a concept of all AOP implementations, which is the root method of the Spring AOP framework and the JBoss AOP framework. The main technical strategy of implementing AOP AOP face-oriented programming ideas have many implementations and implementation methods. The following is a primary technical policy for implementing AOP: 1. J2SE dynamic proxy in Java, implementing AOP's most apparent strategy is too much using the dynamic agent introduced by Java1.3. Dynamic agent is a powerful language structure that enables us to create implementations for one or more interfaces, without having to implement a class in advance. If you need to use a dynamic proxy to achieve surrounding, you can call the necessary interceptor chains therein. The last interceptor on the interceptor chain will call the target object with the reflection - if there is a target object. Dynamic agents are the greatest benefits: this is a standard Java language feature. In addition to the AOP framework, there is no need for a third-party library, nor will it be affected by the application server. The maximum limitation of dynamic agents is that it can only be proxy for the interface and cannot be targeted. That is, the customer-based interface required in "Customer-Infrastructure" needs to be implemented, and then the interface is used to use the new object. However, since we advocate "Programming for Interface", then this restriction is not a bad thing, but it is possible to develop a good "interface programming". In addition, the dynamic agent can only enhance the method calls without enhancing the fields like Aspectj. However, since we use methods to provide all services, "Enhance the field" this feature is completely useless, but will cause programmers to use poor programming methods. Spring framework, use the J2SE dynamic agent to provide AOP implementation by default. Developers can also specify use "Dynamic Byction Code Generation" technology to implement AOP. The Nanning Framework also provides AOP implementation using the J2SE dynamic agent. Second, dynamic bytecode generation To provide a proxy for Java classes, we need tools outside dynamic agents, which is Dynamic Byte Code Generation. In this regard, the most popular tool is CGLIB (Code Generation Library). In Spring, if you need to provide a proxy for classes (rather than interface), CGLIB will be used. It can generate a subclass for the specified class, and overwrite the method thereto, thereby implementing the method interception. However, CGLIB has a small problem: because it is a proxy by inheritance, so it cannot provide a proxy for the final method. Third, the Java code generates the most stupid method, which is to generate a new source code. This method, the earliest is the MTS Microsoft Server, and later Java EJB also uses this method to provide "infrastructure". Although this method is stupid. However, they are indeed early AOP attempts. Now, with the emergence of dynamic proxy and dynamic bytecode generation technology, this practice is gradually exiting popular.
In addition, you have to add: Code generation, basically all the worst programming technology. Often, we can use OOP delegation or AOP to achieve the same purpose. Automatically generate code, will cause numerous terrible problems when you need to modify the code! Microsoft uses a lot of automatic code generation technology, additional MDA model drive development methods and metadata-based generating programming are common source code generation technology. . For these technologies, I have always been doubtful! As long as there are other methods to achieve the goal, I will never use the source code to generate this technology! 4. Use customized class loaders to use customized class loaders, we can automatically enhance them when a class is loaded. Even if the user uses a New operator constructor, enhancement will still take effect. Both JBoss AOP and AspectWerk are enhanced in this approach, and the specific enhancement information is read from the XML configuration file at runtime. The risk of this practice is that it deviates from Java standards. In some application servers, this approach may cause problems because J2EE servers need to control the hierarchical system loaded through class. 5. Language extension If we want to treat aspects as a first-class citizen, you need a language that supports AOP and OOP. In order to achieve this, the existing OO language can be expanded, just like the C extended C language, the concept of OO is introduced. The earliest AOP implements Aspectj, this extension is performed on Java. Aspectj is the most powerful AOP implementation. However, it is a new language, syntax is more complicated than Java. Moreover, it is also necessary to compile the AspectJ source code using AspectJ, turn them into enhanced Java code, and then perform Java compilation, too cumbersome. Spring AOP Framework In all AOP implementations, I think the Spring AOP framework is the best choice. Although the AOP function implemented by the dynamic agent and dynamic bytecode generation technology it is not most powerful, it is already enough for most situations, and it is simple enough without any special requirements. And, the Spring framework is well integrated with Aspectj. When necessary, we can use AspectJ's power to implement AOP. Spring AOP is implemented with pure Java, it does not require special compilation processes like Aspectj, nor does it require control class loader hierarchical, so it is applicable to J2EE container or application server, which also applies to any Java program. However, your program must also use the Spring framework to manage. Spring AOP can only provide AOP services for Java classes managed by the Spring framework. Spring currently only supports intercepting method calls and exceptions, and does not support intercept field access. Spring provides classes representing the entry point or various notification types. Spring uses the term Advisor consultant to represent the object of representative (aspect). It contains an enhancement and a PointCut that specifies a specific connection point (JOINT). The goal of the Spring AOP frame is not to provide extremely perfect AOP implementation (although Spring AOP is very powerful), it provides an AOP implementation that is closely integrated with the Spring IoC container to help solve common problems in enterprise applications. Therefore, the function of Spring AOP is usually in combination with the Spring IoC container. The AOP notification is defined by a normal bean definition. The enhancement and entry point itself is managed by Spring IoC - this is an important and other AOP realization. Some things use Spring AOP to be implemented, such as very fine granular objects, which can be used at this time. Overall, Spring provides an excellent solution for most of the J2EE enterprise applications to use AOP solutions.
How to better use AOP-oriented programming (AOP) to provide a new perspective-cross-cut perspective. Let us look at the point of view of the software from the portrait of the world and become a flat world. It also greatly improved our ability to develop software. Recently, AOP will replace OOP an endless attitude. Indeed, AOP is a nice programming paradigm and thinking, but OOP is the foundation of programming. AOP is only a useful complement of OOP, and between them is not an opposite relationship, but a complementary relationship. AOP is absolutely not, or it is impossible to replace OOP. Each of the two has its own territory, while the OOP has a greater application range! If a software, even the minimum OO principle is not followed, how can it expect to rely on AOP to achieve a strong purpose! Now, there is a tendency in some programmers, which is to program the application AOP in the programming. Just find that any call code is repeated, use aspects to be solved. This has caused too many aspects in the program. The logic of the entire program has become difficult to understand and modify. I think it should only use the AOP "Customer-Infrastructure" to solve it in the event of a large number of calling code repetition, otherwise the "Customer-Server" mode of OOP should be used. OOP should be used when it is difficult to determine whether it should be used or AOP.
Object-oriented programming technology for focusing on software is a programming technology that solves business concerns. For example, an enterprise application, the user needs the function of user management, and all modules of this software require transaction functions, log functions, and security checks. When using OO technology, when we want to write code modules that implement user management functions, we get the system concerned (UML is called "use case", XP is called "user story"), is: User management module, need to increase, Delete, modify, and query the user's functionality. At the same time, all database operations must have logs. To use transactions, check security, only qualified users can call them. We then prepare the software modules that meet these requirements based on this business. Among them, logs, transactions, and security checks code have code repeatedly with other business focused implementation modules. It can be said that OOP is to look at the software system with a longitudinal one-dimensional perspective. AOP is a programming technology that solves cross-cut public attention [9]. For public attention such as logs, transactions, security checks in the above example, we don't scatter them into each business concern, but concentrated together, constitute "cross-cut public attention", using AOP technology, in one module It is also in terms of implementation, and all business attention does not need to know these attention. Of course, these cross-cut concerns will not be embodied in the OO code to achieve business. We can see that whether it is OOP or AOP, it is just a way of programming, is a means of focusing, resolving concerns. But what is the foundation of software development? It is the "attention" of "involved". Software is to meet the attention of the people, meet the attention of the public, then this software is successful! There is no "attention", OOP and AOP have become a wooden, passive water, no target arrow. Enterprise-level applications, largest variables and risks are the changes in the needs of customers, that is, the system "attention" changes. Focus on software development (COSD, Concern-Oriented Software Developments, let us develop software for "attention" of "attention". Also let us use OOP and AOP programming technology under the banner of "attention", to solve the vertical business concerns and cross-cut public attention, complement each other. The idea of focusing on software development (COSD) is a concept of AOP, "Concern", is a thinking result of re-examining the relationship between OOP and AOP. Representatives of agile development methods are the most discussion, the most practical, controversial, and the most controversial. A agile development method. XP is a set of values, principles, and activities that can quickly develop high quality software, so that software can be developed as fast as possible and provide the highest benefits to customers. The premise of XP is a hypothetical assumption: Smooth cost curve - the cost of change will not rise sharply over time. Instead of conventionally considering "changes in the cost of change over time" [7]. Traditional computer scientists believe that changes to software will become more difficult as project time has become more difficult, and the cost will be a few more times to consider these demand in the early days of the project. This is the fact that it is indeed software development. However, with the development of object-oriented programming technology, this hypothesis has become inconsistent with the actual situation! Programmers with good object-oriented programming technology, can develop high-intensive, low coupling, simple, easy-to-modified robust software, "cost curve" is "smooth", not "steep".
Even after the software is completed, the software is largely modified and added new features, it is only clearly defined in the current time when the project is started. Therefore, if you want to use XP to succeed, you must first need to be able to master those methods introduced in the previous chapter of this article, so that the software is more massive. It can be said that XP is relatively high for developers, requiring a solid programming level and object-oriented ideas. Why do I need XP then why we don't determine all the needs before the project begins, but to modify the software when you have already completed it? If you can do this, of course, but in reality, we often can't do this. 1. Programmer is an expert for development software, but it is not an expert in the field of software applications. Although users are experts in the field of software applications, they often don't know what software can do, what can't be done, or do a job. Due to developers and users do not understand each other, developers and users cannot clearly define the functions required by the developers and users before the software is actually developed. Often until the software is actually developed, after the user tries to understand what software you need. Especially in enterprise applications, after software development is complete, large-scale modification software is a frequent forever. 2. As time goes by, the environment of software applications itself has changed. Especially in enterprise applications, the business environment of the company has been in constant changes, which requires enterprise applications to adapt to the changes in the company. And these possible changes are difficult to foresee it for developers. 3. In the general software development process, we often choose multiple versions, stage development software. That is, first develop a primary version, issue. Then add other functions on the basis of it. This is a general software development strategy. This also requires that we cannot take into account all the needs of our software within a certain year in the early days of software development. For example, the Windows operating system, this software has launched for more than ten years and has released countless versions. Obviously, it is impossible to foresee today's Windows when developing Windows. In short, during software development, changes in demand are inevitable, absolute. The constant demand is temporary, relative. In the face of uncertain future, before, "the cost of change in the change in the change is in the early stage of the project development, the future changes in the future, trying to grasp" uncertain the future of". However, this is often futile. Moreover, the result of this is often complicated to the original simple demand. Among them, there are many needs that are not required. For example, it is now popular. Many programmers want to certainly think that the software needs to provide remote calls such as remote calls. They spent hard to use complex CORBA, Web Services, RMI, EJB and other technologies such as technology, which greatly increased the development cost of software, and in fact, most software did not have such a need. Moreover, even if it is really necessary to provide a remote call function, for the design of good software, it is not difficult to increase this feature. Simple software is complicated, but customers need to pay for the function that does not need! Fusion XP software development process If we implement programming technology developing healthy software in software development, our software is more robust, that is, it is in line with "smooth cost curve - the cost of change will not rise sharply over time "The premise of this practical XP, then we can use extreme programming methods to develop software, improve software development productivity and business value. The software development method of obtaining the need is called "demand investigation".
Because, according to the traditional method, it is the need for developers to investigate the research software. Unlike XP, XP is to provide customers with the demand for developers under the guidance of software developers. Because the programmer is an expert for development software, but it is not an expert in the field of software applications. Obviously, what should the software should be more saying? The demand for software should be provided by customers. 1. Preliminary proposal software demand customers propose the functionality that the software should implement, and the developer tells customers whether these functions can be implemented, and how much cost is required. What functions need to be implemented by the customer final decision. At this stage, the needs of customers are not necessarily to be detailed, only a rough demand is required. If you go deep into the details, you will fall into the trap of excessive demand research and analysis of traditional development methods. XP Practice: Small Version - A simple system is quickly put into production, then publish a new version in a very short cycle. XP divides the entire software into multiple small versions, multi-stage issuance. The customer is divided into multiple versions in a plurality of versions based on the priority of the function. However, the first version, if there is no software architecture, then this version needs to implement which functions are determined by the developer. Developers choose functions that make it easy to build architectures, such as user management, permission management, etc., first implement it. Second, the software demand proposed in the software demand in the development is roughly, summarized, and there is no detail of the software needs. After entering the version development, we need customers to provide sufficient demand details to support "demand drive development". For example, in the initial demand phase, users manage such demand, in the version development phase, what kind of user management functions need to be clear, for example, there is a need to increase, delete, view, and modify user information. Expressed with UML is the "user management" use case. Increase, delete, view, and modify users of these four detailed sub-cases, or four event streams. Once the programmer gets the determined event stream, it can be based on this, and the "sequence diagram" of the UML is drawn and the driver software development is expanded. Third, cross-cut public attention developers from the system requirements provided by customers, extract public system requirements, such as, log, access control, etc. For these cross-cut public attention, we can use OOP to implement. Write a class to provide these services, then use the "Customer-Server" mode in each business module to call this class's service. Alternatively, further, the use of AOP is implemented. Write aspects to provide these services. These services are provided in the business module without knowing the call mode of "Customer-Infrastructure". The philosophical idea of test-driven development and acceptance test level reconstruction is the philosophical idea of exclusationalism: "Anything that cannot be measured is not existing" [4]. Extreme programming against traditional development methods pay attention to process and documentation, advocating fast development, construction, testing, and deploy software. It is believed that all decisions should be based on the actual results of the software, not an endless guess. I often "ask the computer" [8], not based on a fair fair belief, this is the basic programming principle of XP people. XP people first need to be a believer that converted to exciseist philosophy. Therefore, XP development methods and processes can be represented by such formulas: software = test drive development reconstruction. I. How can I have the development of the developer that have implemented a customer needs? This requires test - acceptance testing. The acceptance test is written by the customer with the help of the developer before the use case implementation. The acceptance test is a text that verifies whether the system has met the customer needs. Developers can use this text, formulated with specifications of scripting languages. Typically, we write a set of scripting languages for each application.
Typically, we use the form of XML files or the form of text files. Developers write a simple program that read this acceptance test text file, according to the content in the text file, call the corresponding method in the software, and must be performed. The correspondence between the scripting language and the specific method is defined by the developer. In fact, the acceptance test [2] is a user interface of the program, which is a user interface based on a text file or an XML file. It is a simple interface to call the software core business logic. Through it, we can know if the software's core business logic is operating normally. The acceptance test is a program, so it can be run. We can run these acceptance tests frequently during software development to ensure that software has been in the right state. Moreover, the acceptance test does not have a user interface, and can be run quickly as a batch of unit tests, saving the result to the file. Acceptance test is the ultimate executable documentation for a software function. Programmers can read these acceptance tests to truly understand these functions, understand how to implement these functions. Acceptance test, itself is "event stream", programmers can draw "sequence diagrams" and implement the software development of acceptance test driver. By acceptance test, drive software development is the software development method recommended by XP. Second, "Customer-Server" mode layer delegate development software We use the "Customer-Server" mode to write software through the way of delegate. The sequence diagram describes which services are provided, and the event stream is completed. We can write the logic of the sequence diagram into a controller class (or called "business delegation". The so-called business delegation means that there is a "representative layer" between the client and business service layer, all clients to the server. The end of the end is "delegate" this layer. [10]). The controller is the first customer of our core business logic. It consists of "Customer-Server" relationships and business services, which may also form a "customer-server" relationship with the domain model class of the domain module. In order to realize the function of the user request, we call several methods in the controller to implement this user needs. However, now we have no ways that can be used. We now still write the way to call in the controller, although they have not been written and implemented. It doesn't matter, it will be implemented in the future! These methods are assigned to various classes of each module in accordance with logic and whether they will be repeated as criteria in the client. Divide these services into each interface in accordance with the principle of "interface" programming, not the class. We can use the CRC map to help complete this assignment method. Now, although the program has not been developed yet, we already know that the program has been logically complete, or, it has been designed. We only have two simple implementation levels to do: 1. Writing the implementation class for the interface, implementing the required method; 2. Using the reconstruction, these methods are moved to the most suitable interface and implement the class. Third, the acceptance test level reconstruction refactor is "Make changes to the code" without changing the external behavior of the code, "to improve the inner structure of the program" [5]. Once you write a good code, any modification of the code can be considered. Reconstruction always links with the test. Without automated testing, it is impossible to perform effective reconstruction. According to the test required, the reconstruction can be divided into two categories: one is the "reconstruction of unit test level", and it is also the most widely used reconstruction. However, this type of reconstruction is only the quality of the software, which is generally an improvement in one or two classes. The other is "Reconstruction of Acceptance Test Level", which is a refactoring of the quality of the entire module. It is an improvement in the implementation mechanism of the entire module, often involves modifications to multiple interfaces and classes.
In the process of demand variation, relying on automated acceptance testing, we can easily perform acceptance stage reconstruction, quickly respond quickly to changes in software requirements. It can also make the software become more robust. Unit test drive development and unit test level reconstruction When writing a specific class, we also use "unit test driver development". First write the test class, and then write a single-by-way completion unit test, and finally complete the writing of the class. When you need to improve the implementation code of the class, the reconstruction of the unit test level is used to improve the internal structure of the class. The XP development software is from the top of the top, and the layer of test drive is developed by testing, and the use of these test security is reconstructed in need to improve. In the end, the development of the entire software and the quality of the software can be guaranteed and measured by acceptance testing and unit testing. Customers can monitor the progress of software development at any time. The money that the customer spends directly to see the results. Moreover, through a small version of the fast iteration, customers can enjoy the results of software development, can also terminate the uncommon software items immediately, without causing all the East streams that are put into investment. Reference architecture using Java development enterprise-level applications now, let us use Java's actual development of two enterprise-level application reference architecture. This architecture does not achieve specific business needs, just two architectures for developing enterprise applications. This architecture is robust, easy to modify, and it is also a "smooth cost curve - the cost of change will not rise sharply with time" this XP requirement. Javaee Java EE, Java Platform Enterprise Edition, is a standard platform launched by Sun for enterprise applications. The Java platform is divided into three major versions Java EE, Java SE, and Java Me. It turns out that they are called J2EE, J2SE, J2ME. Java EE is a set of extended standards developed using Java. The Java EE platform provides multiple layers, distributed application models, reuse components, and unified security models, and flexible processing control capabilities. Java EE includes EJB, JTA, JDBC, JCA, JMX, JNDI, JMS, JavaMail, Servlet, JSP, and other specification [10]. "Classic" Javaee architecture usually, people think that Java EE is a distributed platform, and EJB has a central position in the platform. "Classic" Java EE architecture is such a [7]: 1, Java class is scattered in different JVMs, although it is necessary to eliminate remote calls in different JVMs. 2, the web layer is generally implemented by an MVC architecture (which is also the same as other architectures). If the application system design is more careful, there will be a dedicated client agent layer, which is called remote EJB, so that it can clean the WEB layer and EJB coupling. 3, all business objects are both stateless session beans with remote interfaces, run in the EJB container. EJB containers provide remote call mechanisms, transaction management, thread management, possibly with role-based security services. 4. All data access must pass the Entity Bean. The Entity Bean provides O-R mapping. 5, the EIS layer consists of one or more databases or legacy systems. If there are multiple resources with transactions, JTA services accessed through the EJB container will be responsible for coordinating distributed services. Local EJB can also be used for enterprise-class applications that are not prepared to provide EJB cluster services or remote call EJBs. This architecture of Java EE provides powerful remote calling capabilities, JTA declarative transactions and statement security, as well as the capacity of cluster deploying EJB. This will occupy the enterprise application market in just a few years.
However, this architecture has been discovered in many years of weakness: 1. This architecture has developed very difficult and inefficient. This is mainly the EJB specification is too complicated. According to the definition of the EJB2.1 specification, the EJB component must have a lot of interfaces, such as the Home interface, Remote interface, local interface, and more. You have to define a number of XML description files for a variety of application types. When we need to access a component or service, we must find the object through the name binding service through the name of the name. 2. It is also very inefficient to run. The implementation mechanism of Entity Bean has problems, causing the Entity Bean access to the database very inefficient. Even, very few people currently use Entity Beans to access the database. However, if you don't use the Entity Bean, the Session Bean uses other database access methods, there will be some problems. Because some database access mechanisms, such as Hibernate's Session Factory must be a single instance, and the session bean is unable to implement single case. In addition, EJB performs efficiency is slower than POJO. In the past, people think that EJB is the core of Java EE. However, in fact, all Java EE services, including JTA, RMI, JNDI, JMS, etc., can be used out from the EJB container, which is actually the function provided by the web container, and the EJB container only provides an access to these services. Method, we can use these Java EE services directly without EJB. Java Open Source Software Java is an open technology that is developed by the official JCP (Java Community Process) organization, also promoted by the Java open source community. The programmer of fighting in the first line has developed a lot of open source Java software, which has been greatly used, which greatly promotes the development of Java. I will use these open source software, combined with the services provided by Java EE, do not use EJB to develop enterprise software. Struts is a web layer development framework that is implemented using MVC mode. Currently, it is the mainstream web layer development technology in the Javaee field, regardless of using EJB or other technologies, generally uses it to write web layers. Ant is a standard building tool in Java world in fact. It can perform a range of automation tasks, including building projects, running software, and automated running unit tests. JUnit is a unit test tool developed by XP founder Kent Beck. You can run the JUnit test using ANT automation. Hibernate is the standard framework for the actual O-R mapping. It is configured to map the database table and the POJO object in the Java program, automatically update the database through synchronous caches and databases. It allows us to use a relational database like using an object-type database. The Spring framework is a lightweight application framework. The goal of Spring is to provide a single-running solution that integrates various dedicated frames into a coherent whole. It can integrate Struts, Hibernate and other frames, even simplify EJB development and access. Spring's power comes from two aspects: IOC container and AOP framework. Using the Spring framework, you can fully replace the EJB function. These open source frameworks can help us achieve non-EJB enterprise applications. Simple Java EE architecture without EJB For simple enterprise applications, we can use simple technology. This architecture, although it is simple, but still very robust.
Using Struts as a web layer development technology, use POJO as a business object, using the DAO mode packaged JDBC as data access layer technology. With DAO mode, we also have a simple O-R mapping. In a typical customer-use implementation module, our class is divided into the following sections: 1. Struts controller module Action, in fact, is the "business delegation" model business delegation class. They receive user requests from the view, and then call the business service class to implement the user's request. Action is the same as a single example. That is to say, there is only one example of an Action class on a machine to serve all customers. That is, it cannot save the state of the customer because the status can be saved in httpRequest, httpsession, servletContext. 2, the Model-ActionForm in the Struts MVC mode is used to pass data between Action and the view. Data in ActionForm, if you are submitted as a form, you need to be String type. 3, domain model of the field module. It is an object that represents a database table in the O-R map. As also as parameters and return values, data between the controller Action class and the service service service service class, and the Service class and the DAO class. In Action, the data container class ActionForm that Action is not capable of directly calling the service service service class directly to the domain model object, or the simple object can be used as a parameter to call the service service service service class method. The parameters returned by the method of the Service class must also be encapsulated into the ActionForm to allow the view to be displayed to the user. 4. Business Service Service Service Interface and It Implementation The Action To call all business operations to call in the class service interface. It has realized this interface. The Service implementation class is POJO, not the session bean. The operation of interacting with the database is delegated to the DAO interface in the service class. Service implementation class should also be a single case, because it only provides services and does not need to save status. All data can be passed through the parameters of the method. To implement a single case, we can use a factory class, or you can provide a single-case implementation method directly in the Service implementation class. Here, for simple, I directly implemented a single case in the service implementation class. public class JDBCMessageServiceImpl implements IMessageService {private static JDBCMessageServiceImpl instance = null; / *** @return JDBCMessageServiceImpl Service returns an instance of this class * / public static JDBCMessageServiceImpl getInstance () {if (null == JDBCMessageServiceImpl.instance) {JDBCMessageServiceImpl.instance = New JDBCMESSAGESERVICEIMPL ();} Return Instance;} ... 5, Data Access Object DAO Interface for Domain Modules and It Implementation of the Differential Dynamic Davids in the DAO interface. With DAO, we implements mapping between domain model classes in memory and database tables on the hard disk. Here, the DAO's implementation class is class that accesses the database using the JDBC mode. The DAO implementation class is the service class for providing data access services, should also be single case. We use the same way as the Service class to implement a single case.
In the DAO implementation class, we try to use the domain model class as the parameters and return values. In this way, the O-R mapping between domain model classes and database tables is realized. In addition to the DAO implementation class, we can use the domain model class to manipulate data in the database table. In this architecture, we use interfaces in the Service module and DAO modules - implementation. For the same interface, there are countless implementation classes. Here, I only use JDBC to implement a DAO interface. In fact, we can easily prepare a DAO implementation class using other data access technologies such as Ibatis, Hibernate or JDO. In addition, we can use the connection pool independent of the Web container. We can use the JNDI of the web container to publish the data source of the connection pool to JNDI, and the customer code is obtained from the JNDI to the data source instance, call the connection in the connection pool. However, different web containers publish JNDI is very inconsistent, and JNDI is also very much. We can use Apache's DBCP framework to write directly to the pool. This doesn't require any support for any web container, which can be used in a general Java program. If you need a remote call, we can integrate AXIS in your app to provide Web Servics. If you need a cluster deployment, we can also deploy multiple web applications on multiple servers. 1. Advantage of this architecture 1. No EJB container is required, only the web container can be reduced, reducing costs. 2, do not need deployment descriptors as ejb. 3. It is easy to switch between different web containers and application servers. 4, achieve more simple, business service service and data access objects DAO are simple Pojo classes. Second, the shortcomings of this architecture 1, where direct single example mode is used to generate a single example, rather than using container management to implement single case, and there is a certain coupling between the code. 2. Similarly, since there is no instance of the container management object. Therefore, we must manually call the interface to create a single example of the class in the customer code. Thus, there is a certain coupling in the code. If you need to change the implementation class, we must modify the source code of the customer who is invoked to implement the class. For example, in the Action: ImessageService messageService = JDBCMessageServiceImpl.getInstance (); In addition, the Service implementation class, also needs to be of a single embodiment DAO implementation: public class JDBCMessageServiceImpl implements IMessageService {private IMessageDao messageDao = null; public JDBCMessageServiceImpl () { / * Since there is no metadata configuration, it is necessary to directly incorporate an instance of the class in the constructor. * / SetMessageDao (JDBCMessageDaoImpl.getInstance ());} ... 3, we must manually write a transaction, and cannot use the container management transaction CMT provided by the EJB container. EJB's CMT allows users to declare transactions in configuration files without having to manually write transactions. 4, cannot be able to use EJB declarative access control for session beans, Entity Beans. The access control provided by EJB can control access to the EJB method. Of course, this architecture can be achieved through the access control mechanism of Web Services. Moreover, although EJB provides a mechanism for declarative access control, it is very difficult to transplant due to different configuration methods due to each EJB container, so it is rarely used.
In short, this architecture is simple, strong and powerful. This simple architecture can be used for small-scale enterprise applications. For larger-scale enterprise software, perhaps use a more powerful, complex technology framework, more efficient. For example, using Hibernate technology to provide a DAO implementation class, or further, using the Spring framework to manage the single example of transactions and business objects. Since this architecture uses interfaces and implementation of the interface and implementation in the business service module Service and Data Access Module DAO, it is very easy to increase Spring, Hibernate and other frameworks. This is also reflecting this architecture. The Java EE architecture "lightweight container" using the "Lightweight Container" means a method of managing, locating business objects. Generally, IOC reversal control containers. It is actually provided a Dictionary class or similar class, which is a collection of name-value. When the container is started, it generates an instance of a class, and then placed in this dictionary. When the instance of this class is required, if the instance is declared, the object is removed from this dictionary. If the declaration is multi-model, the container generates a new instance to return to the customer code. This achieves a single case. It is no longer necessary to write a single code in the general POJO class as above. Moreover, now, only the interface is required in the call code, and there is no need for a specific implementation class. We can change the information provided in the configuration file and do not need to modify the source code. Spring is such a lightweight container. Java EE's JNDI can actually be seen as a container. It is a registry, which is a collection of "name-value". Different, it puts these objects on the Internet. Access JNDI object is very troublesome. In addition, Spring also provides an AOP framework that allows it to provide a declarative service, such as a declarative transaction like the EJB container. Moreover, it is more powerful than the EJB container and you can write yourself. Spring's IOC container and AOP framework allow it to be fully replaced with EJB containers. It is simpler and more powerful than EJB containers. Of course, there are other IOC containers and AOP frames, but only Spring combines both. So, here I use Spring to develop architectures. First, the Java EE architecture using "lightweight container" This architecture is very similar to the previous simple Java EE architecture without EJB. Here, we give the previous architecture to modify it to become the Java EE architecture using the "lightweight container". Web layer, we still use the Struts framework. Business Service Module Service and Data Access Module DAO still uses Pojo and Interface - realizes the style separated. In the DAO implementation class, we add Hibernate's DAO implementation classes to demonstrate Hibernate. Of course, the original JDBC-based implementation class is available. First, after using Spring, with Spring's IOC container, we don't have to provide a method of creating a single case in the Service and DAO implementation classes, and there is no need to create a DAO implementation class. Single case. It only needs an empty constructor, and then configure the properties in the configuration file to pass the instance of the DAO implementation class through the SET method. In the Struts's Action class, no longer need to obtain a single case with a SPRING's single-case method, but through the spring getBean ("*") method from Spring's registry to the service implementation class single example. Even if you implement class changes, you don't need to change the source code, just modify the Spring's XML configuration file. Spring provides a way to integrate Hibernate.
You can also place a single example under the management of Hibernate's SessionFactory objects. Spring provides several classes directly, providing transactions in XML files through configuration, declarative. Not only can Hibernate provides a transaction, but also provide a statement-based transaction for JDBC in our previous architecture. If we use the application server to provide JTA transaction support, Spring can also provide JTA transactions by declaring. In addition, Spring also has a subproject, Acegi Security System for Spring. This framework is a secure mechanism that uses the Spring AOP framework and web container, plus a secure mechanism implemented by local thread variables Threadlocal. When protecting Web resources, use the web container standard Filter filter mechanism, when protecting the POJO class, using Spring AOP declaration protection, can protect any Spring management POJO method. This is more powerful than the declaration safety mechanism of EJB, and EJB can only protect the EJB component. However, ACEGI's security mechanism is more complicated. If it is a B / S application, just provide protection for web resources, it is recommended not to use it. It is more suitable for approach to remotely called components such as Web Services, RMI, EJB, HESSIAN, BURLAP, and Spring HTTP Invoker, etc.). Second, the advantage of this architecture 1. Simple architecture, but powerful, even more powerful than classic architectures of the EJB container using heavyweight. 2, such architecture and simple architecture without EJB, you can implement cluster deployment by deploying multiple applications. 3. Compared with the simple architecture without EJB, this program uses a lightweight container, which does not increase how much complexity, but it reduces the code and reduces complexity. It is of course easier to learn and configure compared to the EJB container. 4. If the lightweight container provides AOP, it is possible to provide more powerful infrastructure and declarative services than EJBs. 5, this architecture does not require EJB containers. 6, Spring has provided a number of classes that allow us to access many Java EE services, such as JNDI, attribute files, etc., can be fully configured. It also provides support for some common frameworks, such as Ibatis, Hibernate, etc. With the Hibernate support class provided by Spring, we can simply use Hibernate, the code amount is much smaller than using Hibernate! 7. Since we don't use the EJB container, it is rarely used the service provided by the web container, so our app can be easily transplanted without using the application server. 8. IOC allows the lightweight server to "assemble" objects. That is to say that the application is not needed to write or generate a collaborative object. For example, the Service implements an instance of the DAO implementation class in the service class. 9, there is no code for these assembled objects, we can still use JUnit to test our app. Because the lightweight framework can be run in any Java program. We can create and use Spring and other lightweight containers in the JUnit test class. Summary "Source code is design" in 1992, Jack W.Reves wrote a papers "What is software design", the answer is "source code is design"! [2] The process of compiling the source code is the process of software implementation, and the process prepared by the source code is the process of software design.
As for what we often analyze software and design software, just higher levels of analysis and design processes among software design processes. They are still analyzed and designed. The true final design documentation of the source code. Source code, there are two types of readers, one is a compiler, which compiles the source code into software that can be run, which is the only requirement for source code, which is in line with language specification, without syntax errors. Another category is the developer of the software, they need to read and modify the source code frequently. They are ordinary humans, only to understand the text of the organization, and the logical clear text. Obviously, the most important readers of the source code are obviously these picky people. The source code is a design document, which is an explanation article on how to organize the software. Do you have a book of dozens of thousands of words? If you want to write a book of hundreds of thousands of words, how can you let readers can easily read, understand, then modify it? Write such a book request, it is the requirements of writing code! Obviously, the code we have written should organize reasonably, give logic, have enough abstract levels, allowing readers to go deep into details step by step, rather than directly to readers directly. Chapters, festivals, segments, isn't it very like source code packages, classes and methods? Agricultural software is the software that developers is easy to read, understand, and then modify; it is simple, logical and clear software; it is a simple structure, each layer is simple, logic is clear! The development of software technology is the development of the abstract capabilities of source code! Summary These programming technology and software development methods discussed herein, not only has positive significance for the development of robust enterprise applications, but also make sense to develop all types of robust software. Learning and practicing these programming technologies and development methods will effectively improve the quality and business value of the software we have written. Thanks, this article was completed under the well-director of Professor Liu. Professor Liu gave me a great guidance and help in theory, methods and practices, so that I have greatly improved the theory and practice, and successfully completed this paper. Here, I would like to thank the instructor sincere. I would also like to thank my colleagues in the company. There is also James Gosling, thank him to bring Java, my favorite programming language. Java changed my life! At the same time, I would also like to thank all the teachers and classmates who gave me and help me during the study of China University of Science and Technology. Finally, I will help my teacher, classmates and colleagues again! Enterprise App Structure. 王怀民 Zhou Bin Translated. Machinery Industry Press, 2005. [2] Robert C.martin. Agile Software Development: Principles, Models and Practice. Deng Hui. Beijing. Tsinghua University Press, 2003. [3] Erich Gamma, Richard Helm, Ralph Johnson, ET Al. Design mode: The foundation for object-oriented software. Li Yingjun, Ma Xiaoxing, Cai Min and other translations. Beijing. Machinery Industry Press, 2005. [4] Rod Johnson. J2EE Design Development Program Guide. Wei Haiping. Beijing. Electronic Industry Press, 2003. [5] Martin Fowler. Reconstruction - Improved Code of Existing Codes. Hou Jie, Xiong Festival. Beijing. China Electric Press, 2003. [6] Kent Beck. Resolution Extreme Programming - Embrace Change. Tang Dongming. Beijing.