Java EE, as the development of mission-critical enterprise-class application of a set of standardized integration platform, more specifications, a wide range of content, so as to develop Java application has brought a lot of "trouble." For example, in order to implement RDBMS storage for content, we might have JDBC, Entity Beans, JDO, O/R mapping Tools (TopLink, Hibernate), XM L-dbms, JAXB, and other methods ( Some of these methods are not included in the Java EE specification. Therefore, to achieve the Java EE layer (at least the presentation layer, control layer, business logic layer, etc., 3 layers) and the coupling between layer and layer, Java EE System Architects need to consider a lot of problems. Plus, the rapid development of Java-EE itself, to the structure, the development of industrial strength of the application of Java EE brought some difficulties.
At the same time, software development technology has never "silver bullet", so the technology is not omnipotent Java. However, if we combine the specific business needs on the basis of reasonable application of good Java technology, the results are conceivable. This paper attempts to start with my previous project experience, to explore the development of the application of Java EE should be followed by several criteria, hoping to play a role in the discussion. In this paper, we discuss the application development of Java EE under the 3.2.1 of JBoss.
1. Choose a reasonable structure based on business needs
It is not enough to separate the advantages of the technology itself if it is divorced from business needs. Various technologies have a specific background, many of which are triggered by industrial demand. Generally speaking, enterprise Information System (EIS) requires itself to be stable, safe, reliable, efficient and easy to maintain. At the same time, each enterprise information system has its own unique requirements, may sometimes need to consider the integration of legacy systems, so understanding the specific business needs of various enterprise information systems is critical to the overall system architecture.
For example, if most of the data used in the Java EE application to be developed comes from external data sources, the data may be imported directly from the external data source to the database of the Java EE system to be developed via JDBC. In this case, if in the development process, only use JDBC to operate the database, for small intensity (concurrent access to the user, less data traffic) situation, obviously is more appropriate, but if, concurrent access to more users, large data flow, to the database layer more frequent use of the situation, It seems to be a little powerless. Therefore, for this kind of demand, we can consider using entity Beans with caches. For example, in the JBoss 3.2.1 for entity Beans Cache strategy, you can consider the use of, that is, "Standard CMP 2.x Entitybean", the Way and "D" Type of commit-option to ensure that the content of the entity beans is synchronized with the data source and that the performance of the system is greatly improved (compared to the direct use of JDBC). Some of the entity beans can be set to read-only to improve performance. Of course, there are other R/O mapping technologies, such as TopLink, that can be used here.
Consider, for example, the fact that if the data used by the enterprise information system to be developed is generated and manipulated by the system itself, it is recommended that CMP Entity beans technology be used. Entity beans to everyone's bad impression, which may be related to the bad image that EJB 1.1 left us. However, EJB 2.0 (or 2.1) has been greatly improved, and the local interfaces, CMR, Read-only, and session Fa?ade modes have injected vitality into entity beans. Of course, many concurrent users, data flow is very large will reflect the use of entity beans advantage. One of the key points: to pay attention to the performance tuning of entity beans technology, each application server has its own set of performance tuning program. For JBoss 3.2.1, the configuration file Standardjboss.xm L provides a entity Beans technology tuning Portal. For example, the proper use of the Bean lock strategy is important for entity beans tuning. This allows us to focus more on the business logic of the system, not just the underlying database (EJB tuning is in EJB container, so we are at the high-end of Java EE performance, not the bottom, the database layer. At the same time, the database layer of the optimization of the Java-EE system has greatly reduced the portability of databases. )。
In short, to combine the specific needs and conditions of each system to give specific technical framework solutions, and not alone to discuss the quality of the technology itself.
Reasonable selection of 2.fr Amework
The design pattern plays an important role in the Java EE application System. Therefore, there is a problem in front of everyone, is the realization of their own specific design patterns, or with the help of Third-party fr Amework. If your company is not big, or that the company does not want to apply FR amework in the Java EE Foundation to devote a lot of energy, choose the existing more mature, stable, and existing Java Specification Compatible technical framework will be more sensible.
Generally speaking, the FR amework itself, or the Java EE platform itself, implements and optimizes the specific design patterns, rules, such as business agents, service Locator (including Web tier and EJB tier, the respective services locator, which serves as a unified management of limited resources, Cache related resources, easy to transplant system, Front Controller, DAO and so on. The existing Java-EE fr amework is quite rich. Like what:
Struts: For the 2-type Fr amework, it would be wise to choose her now and in the future (as the JSF specification and technology matures). Currently, struts has developed to version 1.1. Its intrinsic MVC main line, to the back-end data operation method has not limited, assembled the Apache Jakarta Project group outstanding Related Project's essence, is the development Java EE application Jiapin. At the same time, for the next generation Java platform technology JSF with the. NET Web forms feature, struts itself takes into account compatibility and integration with JSF. For example, the JSP renders the presentation layer, the Servlet rendering control layer, and the EJB rendering data storage layer. Between each layer, we can communicate with the value object and HTTP related object to realize the perfect application of Java-related technology.
LOG4J: I want to use "System.out.println" ("") for the habit; Readers, log4j is the gospel of everyone. Although the Java 2 Standard Edition also has a java.util.logging package to ensure log output, log4j's simplicity, efficiency, and flexibility have become a choice for many projects. Log, to some extent, can test the stability of the system, correctness, so the use of configurable log4j (currently, LOG4J has taken into account the compatibility with the Java.util.logging package) is not wrong. For example, JBoss 3.2.1 itself is the use of log4j to manage the log.
Realmethods: Some readers may not yet know the killer. Well, here's a brief introduction. Realmethods is a development of Java application of the FR Amework, she is different from struts (mainly in the implementation of Model 2,J2EE application front-end), Realmethods for the application of Java EE All levels have detailed and efficient support. At the same time, Realmethods used to be commercial software and now has become a product of open source, so you can now see all of its source code.
Bc4j:oracle's business component for Java. Its content and external characteristics and advantages, it goes without saying.
Of course, there are a lot of similar Fr amework. As a team to develop the application of Java EE, we need to select a variety of Fr Amework, choose the framework suitable for the project needs, team, company development direction.
Under normal circumstances, the target product to be developed should not use too much fr amework. First of all, the technology development of Java EE is very fast, too much FR Amework make the follow-up upgrade, maintenance disadvantage; Second, we can learn from the good side, such as the study of realmethods implementation of the corresponding design patterns, and to adapt her to fit our project needs; third, FR Amework itself will be changed, if the choice of too much, will add to the development team burden, which is not conducive to project management. Selective use of existing mature fr Amework can improve the development efficiency and development level.
3, the choice of development mode
The development of Java EE application requires the target developer to master the various technologies. However, the reality is not the case. As a team, each person has his or her own different skills, interests, and savvy. At the same time, the Java EE itself needs to embody social division. In general, our development team will not have the various development roles required by specification. There are usually only 3 kinds of reality (and possibly two): art, JSP programmers, EJB programmers. In the face of this division of labor, the team should pay attention to communication, communication, pay attention to the consistency of the code.
In general, the team should try to use the version Control tool to manage the code and try to have a complete running version every day. Over time, the team adapts to this development pattern. The version control tools must be used to facilitate the management, control, and backup of the code. There are many levels involved. For example, the choice of development tools should take into account the use of version control tools, the rational use of modeling tools to facilitate effective team communication and communication.
Based on the existing development model, individuals think that 3 sets of programs are good. First, using together as a modeling tool, using JBuilder as an IDE tool, using VSS (or CVS) as a version control tool, and using JBoss as a server to develop the Java EE application development phase. Second, use the WebSphere Studio suite of tools. Third, use Eclipse (or JCreator), Ant, xdoclets as a development tool.
Of course, writing, compiling, packaging, deploying, and testing the Java EE application by hand will enable developers to understand the specifics of each development phase. But I think, as long as developers have this attention to specific details of the attitude, the use of powerful modeling, development tools is sensible. Development tools do not improve developer skills, but she can guide developers in the right direction of development. For example, the Jbuidler 9 Enterprise provides the EJB Wizard with the "Struts + EJB + Session Fa?ade + Value ob ject" features such as the industry's widely used Java-EE architecture.
4, pay attention to each stage of the testing work
Test work is often overlooked by many project managers, unwilling to spend time and expense content, because that would increase the cost of the project. However, they ignore that the quality of project completion often has a great relationship to the cost of the project. For example, if the software quality is poor, and did not experience the testing phase, its late deployment, operation costs will be far more than upfront costs.
The test is staged. Unit tests, such as the use of junit, to ensure that functionality is correct. Integration testing to ensure that the system does not have memory leaks and other content. Among them, the Optimizeite Suite Enterprise is helpful for completing Profiler, Code Coverage, Thread debugger, and so on. I remember that I wrote a swing desktop application with content leaks, but there are many ways to solve the problem. Later, the answer was obtained using profiler. As a result, we use the Optimizeite Suite Enterprise as a test tool for many times now to develop applications. In particular, during the integration testing process, it is helpful to check the memory leak and performance of the system.
Tests are of type. Stress testing, performance testing. There is no good testing tool for current tests that support Java EE applications. However, in general, the use of rational robot can also achieve good results.
Of course, there are many factors for successful development of Java EE application. For example, the successful application of Entity beans is largely related to the design of the underlying database (if the design of the table structure is unreasonable, it will lead to a sharp decline in Entity beans performance) and how to maximize the ability to excavate and enhance the Java EE skills of each member of the team. And so on, the design is very wide.