Keywords: design pattern JBoss EJB Framework Database
J2EE, a set of specifications for enterprise-class applications in the development of Mission-critical. Its standardization, the content of the content, thereby bringing a lot of "trouble" to the development J2EE application. For example, for the RDBMS storage of the content, our possible methods include JDBC, Entity Beans, JDO, O / R Mapping Tools (Toplink, Hibernate), XML-DBMS, JAXB and other methods (where some methods are not included in the J2EE specification) . Therefore, in order to realize the coupling between the J2EE layers (at least 3 layers of the layer, the control layer, the commercial logic layer, etc.) and the coupling between the layer and the layers, the J2EE system architect needs to consider a lot. Plus, J2EE itself has a rapid development of J2EE itself, which has brought some problems with J2EE applications with industrial intensity.
At the same time, software development technologies have never been "silver", so J2EE technology is not universal. However, if we are based on specific business needs, it is reasonable to apply J2EE technology, and the results can be imagined. This article examines the development of J2EE applications to explore the J2EE application to explore the J2EE application to take the role of tipping jade. If you meet this, it is excited.
This article combines jboss
3.2.1
The J2EE application development is described as an example.
1. Choose a reasonable architecture combined with business needs
If you leave business needs, the advantage of separate discussion technology itself is not enough. The various technologies have a specific background, many of which are touched from industrial demand. In general, enterprise information systems (EIS) require themselves stable, safe, reliable, and efficient, easy to maintain. At the same time, all enterprise information systems have their own unique requirements, and sometimes need to consider integration with the original legacy system, so it is important to understand the specific business needs of each enterprise information system is critical to the entire system.
For example, if most of the data used in the J2EE application system to be developed comes from external data sources; and these data may be directly imported from external data sources to Database to be developed from external data sources. For this situation, if only JDBC is used during the development process, it is obviously suitable for small intensity (concurrent access to less users, less data traffic), but if, concurrent access users, data The traffic is large, and the Database layer is used to use more frequently, it seems that some power is not from the heart. Therefore, for this kind of demand, we can consider using Entity Beans with caches. Take a bit, in JBoss
3.2.1
There are a variety of Cache strategies for Entity Beans. At this time, "Standard CMP 2.x EntityBean", the "D" type of Commit-Option is used to ensure synchronization of the contents of the Entity Beans, And make the performance of the system greatly improved (compared to directly using JDBC). Among them, some Entity Beans can be set to read-only to improve performance.
Of course, other O / R mapping technologies can also be used here, such as Toplink.
For example, consider such a situation: If the data used by the enterprise information system to be developed is generated and operated by the system itself, it is recommended to adopt: CMP Entity Beans Technology. Entity Beans gives you the impression of everyone, which may be related to bad images left by EJB 1.1. However, EJB 2.0 (or 2.1) has been greatly improved, Local Interfaces, CMR, Read-Only, Session Fa? ADE mode Injects vitality to Entity Beans. Of course, there are more concurrent users, and the data traffic will only reflect the advantages of using Entity Beans. Among them, it is very important: to pay attention to the performance tuning of Entity Beans technology, each application server has its own performance tuning program. For jboss3.2.1
The configuration files Standardjboss.xml provides the entrance to the Entity Beans Technical Tuning. For example, the reasonable use of Bean Lock strategy is very important for the tuning of Entity Beans. This makes it more focused on the business logic of the system, not just the bottom Database (EJB tuning is in the EJB Container, so we are in the high end of J2EE performance, not the bottom, the Database layer. At the same time, Database layer Tuning makes the J2EE system's database transplantation is greatly reduced.).
In short, the specific technical architectural solution to be given in conjunction with the specific needs and conditions of each system, and cannot be alone in the technical itself.
2, the reasonable selection of Framework
The design pattern plays an important role in the J2EE application. Therefore, there is a problem in front of everyone, is yourself to achieve specific design patterns, or with Third-Party Framework. If your company is not big, or the company does not want to put a lot of effort in J2EE basic application Framework, choose existing more mature, stable, and is more wise to compatibility with existing J2EE Specification.
In general, Framework itself, or J2EE platform itself is implemented and optimized for specific design patterns, rules, such as business agents, service locators (including Web Tier, and EJB Tier's own service locator, to manage limited resources , The role of cache-related resources, easy system transplantation), Front Controller, DAO, etc. Existing J2EE Framework is relatively rich. such as:
l Struts: For the model of Model 2 type, it is a wise move for the present and future (with the JSF specification, the maturity of technology). Currently, Struts has developed to version 1.1. Its intrinsic MVC main line, the backend data operation method is not limited, and the essence of the excellent related projects of the Apache Jakarta project group is, which is a good product for developing J2EE applications. At the same time, for the next-generation J2EE platform technology JSF with the .NET Web Forms function, Struts itself can take into account compatible and integration with JSF. For example, a representation layer is presented through a JSP, a servlet presents a control layer, and EJB presents a data storage layer. Between the layers, the perfect application of J2EE related technologies can be communicated by value objects, HTTP-related objects.
l log4j: I want to use "System.out.Println ("); ", log4j is the gospel of everyone for habits. Although Java 2 Standard Edition also has java.util.logging bag to ensure the output of the log, but log4j is simple, efficient, and flexible has become a lot of project selection. Logs, to some extent, you can test the stability and correctness of your system, so you will not be wrong with the configurable log4j (currently, log4j has taken into account compatibility with java.util.logging packets). For example, jboss3.2.1
It is itself to manage logs with Log4J.
l RealMethods: Maybe some readers don't know this killer. Well, here is a brief introduction. RealMethods is a developed J2EE application Framework, which is different from Struts (mainly to implement the MODEL 2, J2EE application front end); RealMethods have detailed and efficient support for the various levels of J2EE applications. At the same time, RealMethods are previously commercial software, and now it has become Open Source products, so you can now see all of its source code.
l BC4J: Oracle's business components used in Java. Its content and external characteristics and advantages, do not say.
Of course, there are many similar frameworks. As a team developed J2EE application, we need to filter all kinds of Framework, choose the framework for project requirements, team, and company development.
Under normal circumstances, the target product to be developed should not adopt too much Framework. First, J2EE has developed very fast, too many Framework makes the subsequent upgrade of the system; second, it can learn from the good side, such as studying the corresponding design patterns realized by RealMethods, and transforming her to suit us. Project demand; three, Framework itself will have change, and if too much, it will increase the burden to the development team, which is not conducive to project management.
Have selected existing mature Framework can improve your development efficiency and development level.
3, the selection of development model
Development J2EE App Requirements Target Developers can master the various techniques. However, the reality is not the case. As a team, everyone has their own different skill advantages, interests, and understanding. At the same time, J2EE itself needs to reflect social division of labor. Under normal circumstances, our development team does not have the various development roles required by Specification. Reality is often only three types (may also be two): art, JSP programmers, EJB programmers. In the face of this division of labor, the team should pay more attention to communication, communication, and pay attention to the consistency of code.
Under normal circumstances, the team should try to use the version control tool management code, try to have a complete run version every day. After some time, the team will adapt to this development model. Among them, the version control tool must be used, which is easy to manage, control, and back up the code. This will involve many levels. For example, the choice of development tools should take into account the use of version control tools, and the reasonable use of modeling tools helps team valid communication and communication.
Based on the existing development model, individuals think that the three sets of schemes are good. First, use TOGETHER as a modeling tool, using JBuilder as an IDE tool, using VSS (or CVS) as a version control tool, using JBoss as a server for the development of J2EE application development phases. Second, use WebSphere Studio complete tools. Third, use Eclipse (or JCREATOR), Ant, XDoclets as a development tool.
Of course, manually complete the writing, compile, packaging, deployment of J2EE applications, and testing the developer to understand the specific details of each development phase. But I think that as long as the developer has this attitude of paying attention to the specific details, the development tool is wise. Development tools cannot improve developers 'development skills, but she can guide developers' correct development direction. For example, the "Struts EJB Session Fa? Ade Value Object" provided by the EJB elf provided by JBuidler 9 Enterprise presents the J2EE architecture of the industry. 4, pay attention to the test work at various stages
Testing work is often a lot of project managers ignored, not willing to spend time, fees, because it will increase the cost of the project. However, they neglected that the quality of the project is often a big relationship with the cost of the project. For example, if the software quality is very poor, there is no experience in the test phase. The fees brought by the latter deployment and run are far more than the previous fees.
Test is a phased. Unit testing, such as by means of JUnit, to ensure correct functionality correctly. Integration tests to ensure that there is no content such as memory leakage. Among them, Optimizeite Suite Enterprise is very helpful for completing Profiler, Code Coverage, Thread Debugger. I remember, I wrote a Swing desktop app existed content leak, but I didn't have a lot of ways to solve the problem. Later, I used Profiler to get the answer. Therefore, now develop applications, we have used OptimizeITE Suite Enterprise as a test tool. In particular, in the process of integrating test, check the system's memory leaks and performance is very helpful.
Test is classified. Pressure test, performance test. There is no good test tool for testing to support J2EE applications. However, in general, it can achieve good results by means of Rational Robot.
Of course, there are many factors that successfully develop J2EE applications. For example, the successful application of Entity Beans is largely related to the design of the underlying Database (if the design of the design design is unreasonable, it will lead to a sharp decline in performance of the performance of the Entity Beans); how to maximize mining, enhance the J2EE skills of each member of the team . Wait these, the design is very wide.
Thank you, I hope this article gives you happiness and help.