What best practices should be adopted for Java EE development? (Developerworks)

Source: Internet
Author: User
Tags xslt websphere application server
What best practices should be adopted for Java EE development?

A:

Here we summarize 19 Best Practices for Java EE development:

1.Always use the MVC framework:The business logic (Java Bean and EJB components) is clearly separated from the Controller logic (Servlet/struts operations) and the presentation logic (JSP, XML/XSLT. Good layering can bring many benefits.

2.Do not repeat the work:Use common and proven frameworks, such as Apache struts, JavaServer faces, and eclipse RCP.

3.Apply automatic unit test and test management at each layer:Do not just test your GUI ). Hierarchical Testing Makes debugging and maintenance extremely simple.

4.Develop according to the specifications, rather than the application server:It is necessary to keep the norms in mind. If we want to deviate from them, we must carefully consider them before doing so. This is because when you deviate from the rules, what you do is often not what you should do.

5.Java EE security is planned to be used from the very beginning:Enable WebSphere security. Lock your EJB and URL and only allow access by all authorized users.

6.Build what you know:Iterative development allows you to gradually master all Java EE modules. All modules should be involved from the very beginning rather than from the very beginning.

7.When using the EJB component, always use the session fa C Ade:Use local EJB when the architecture is appropriate.

8.Use stateless Session Bean instead of stateful Session Bean:By doing so, your system will be able to withstand the test of faults. Use httpsession to store user-related statuses.

9.Transactions managed by containers:Learn about the two-phase commit transactions in Java EE and use this method instead of developing your own transaction management. Containers are almost always better at transaction optimization.

10.Use JSP as the first choice for presentation layer:XML/XSLT is used only when multiple output types are required and must be supported by a single controller and backend.

11.When using httpsession, try to only save the status required by the current firm. Do not save other content in httpsession:Enable session persistence.

12.Make full use of the features that do not need to be modified on the Application Server:Use Certain features (such as WebSphere Application Server cache and prepared statement)

Cache) can greatly improve the performance and minimize the overhead.

13.Make full use of the existing environment:Provides a Java EE ear and a configurable installation script, instead of a black box binary installer.

14.Make full use of the service quality provided by the application server environment:Design applications that can use the WebSphere Application Server network deployment cluster.

15.Make full use of Java EE and do not cheat:We are committed to building Java EE applications that truly utilize the Java EE features.

16.Schedule version updates:Changes are inevitable. Schedule new releases and fixes so that your customers can get the latest version.

17.Use the standard logging framework to record the state of the program in all the key points in the Code:This includes the exception handling program. Use a log framework such as JDK 1.4 logging or log4j.

18.After completing the corresponding tasks, always clean up:If you get an object from the pool, always ensure that it is returned to the pool.

19.Follow strict procedures during development and testing:This includes adoption and compliance with software development methodologies.

 

For details about the length, please refer to the IBM WebSphere developer technology journal: The most important Java ee best practices on the developerworks Chinese site.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.