Development of J2EE Application

xiaoxiao2021-03-06  101

Essentials of developing J2EE applications: Luoshi Fei (copyright by individuals, citing the source is indicated, not for commercial purposes) Keywords: design patterns JBoss EJB Framework DatabaseJ2EE, as a set of norms to develop mission-critical enterprise application integration platform. 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 paper is described in conjunction with J2EE application development under JBoss 3.2.1. 1. Selecting a reasonable architecture in conjunction with business needs, if you leave business needs, the advantages of separate discussion technology itself are 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. For a few more, in JBoss 3.2.1, there are a variety of Cache policies for Entity Beans. At this time,,,,,,,,,,,,,,,,,,,,,,,,,,,,, The content of the Entity Beans is synchronized with the data source and makes 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 JBoss 3.2.1, the configuration file StandardJboss.xml provides an entry of the Entity Beans Technology 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, Framework's reasonable selection design mode 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. For example: 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. Log4J: I want to use "System.out.Println ("); "readers, log4j is the gospel of everyone. 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, JBoss 3.2.1 itself is to manage logs with Log4J. 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. BC4J: Oracle launched commercial components for 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. Selection of development model development J2EE App Requirements Target Developers can master various technologies. 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.

转载请注明原文地址:https://www.9cbs.com/read-123677.html

New Post(0)