Miles to go …

June 21, 2010

QA#1 – Java EE 6: Standards compliance, Vendor independence, Light-weight deployment – by Adam Bien

Filed under: Uncategorized — arungupta @ 11:43 am

The Java EE 6 platform was released over 6 months ago – Dec 10, 2009 to be specific. This blog has published multiple blog entries highlighting the agility, light-weight, ease-of-development, extensibility, and other aspects of the platform. This blog entry starts a new series sharing feedback gathered from the key Java EE 6 community members in form of Q&A. You can learn about how Java EE 6 is currently being used in production, development and deployment environments used within the community, and even feature requests for Java EE 7.

The first one comes from consultant and author Adam Bien (blog.adam-bien.com) who is an Expert Group member for the Java EE 6, EJB 3.1, and JPA 2.0 JSRs. He has worked with Java technology since JDK 1.0 and Servlets/EJB 1.0 in several large-scale projects and is now an architect and developer in Java SE/EE/FX projects. He has edited several books about Java (FX) and J2EE / Java EE and is the author of Real World J2EE Patterns (http://press.adam-bien.com). Adam is a Java Champion and JavaOne 2009 Rock Star.

Here is a short summary of Java EE 6 from him:

Standards compliance, vendor independence, milliseconds and kilobyte deployment

Read on for other fun stuff …

1. How are you using Java EE 6 today ? What limits your adoption ?

For server-side development Java EE 6 is the simplest thing you can get today. Because I’m lazy – Java EE 6 is the obvious choice. You can get everything you need with a single download. It works really well. Recently I let 20 students in a workshop install IDE, application server + database …in 15 minutes. After that we started hacking. The machines were really heterogenous (Windows, Mac, Linux)- and it worked.

I’m using Java SE and EE since their inception. I didn’t used EJB 1.0 (it was before J2EE), but started with 1.1. In several projects I had to use J2EE but omitted successfully the XML-hell with XDoclet.

This was fixed with Java EE 5 – since then (>4years) there are no more workarounds necessary and you can fully concentrate on the business logic. Java EE 6 became even better.

The adoption of Java EE is far better, than expected (by me). It turns out, that in economic slow down management is really interested in standards again. This is the only explanation I have. Java EE 6 seems to take off. I had to limit the number of registrations in last workshops to 20 and repeat a workshop at a JAX-conference (one of the biggest European conferences). The organizer ask me, whether I would like to repeat a workshop, because they were already 75 registrations. The workshop was repeated – …with about 160-180 attendees.

J2EE was said to be too complex for simple applications. The opposite is true in Java EE 6. It turns out to be any leaner, simpler and more maintainable comparing it with the alternatives. All attempts of wheel re-invention I saw so far resulted in far more complex and harder to understand code.

2. What Java EE 6 technologies are you using and why ?

I’m really enjoying the single-classloader model of WAR-deployment. In all new Java EE 6 projects we got rid off “modular” EARs and EJB-JARs and deployed everything into a WAR. It doesn’t seem to be hype-compatible, but it works very well. Especially if you don’t have any additional versioning or modularization requirements. The lack of dynamic reloading and module-hot-replacement in product is given for the majority of all enterprise projects. In real world the deployment units become even coarser.

I start the implementation of the business logic with EJB 3.1 and JPA 2.0. In case remoting is necessary – I use REST (JAR-RS) with JSON for the vast majority of all cases. CDI (JSR-299 + JSR-330) is even more powerful, but I don’t use the extended dependency injection capabilities (produces, alternatives, custom annotations, stereotypes, events) from the beginning, rather than applying them selectively to solve particular problems. CDI allows you to realize a factory, observer or strategy patterns without any overhead. In fact a plain Java SE solution would be even more bloated.

For the web part – I start with JSF 2.0. Also the adoption of JSF 2.0 is unique. There are many books, tutorials, frameworks and libraries available already. I attended a JSF conference this year with several hundred attendees.

Frameworks like Wicket or GWT are very interesting. I always start, however, with the evaluation of JSF 2. Is is already available on every Java EE 6 server – so why don’t use it. 

I would choose the alternative web frameworks, in case there is an evidence that the solution would be leaner, cheaper or easier to maintain. In the majority of all recent cases – JSF 2.0 was just good enough. Before JSF 2.0 I often used Wicket.

3. What is your development and deployment environment ?

I’m using mainly NetBeans 6.9 “Java Edition” with Glassfish v3 and Java DB / Derby (in early iterations). After the setup and stabilization phase I always use the production databases. These are mainly Oracle, sometimes DB 2 or MySQL.

In smaller teams I prefer the NetBeans build-system (Ant). In bigger teams and projects Maven. NetBeans supports both flavors really well, but Ant incremental deployment is orders of magnitudes faster than maven. You can redeploy an EJB/CDI or JPA entity with Ant in millisecods, with Maven it will take seconds. This is a huge productivity gain.

I also have an IntelliJ 9.0.2 Ultimate license and use this IDE as well. It excels NetBeans in some areas like e.g. JPA QL autocompletion. These features, however, are part of the commercial distribution and so hard to introduce into teams. In most cases I fallback to NetBeans.

4. What previous versions of Java EE / J2EE have you used ? How has the migration to Java EE 6 benefited ?

I used J2EE since 1999. The migrations were never fun. Except the migrations from J2EE into Java EE 5. Because Java EE 5/6 have still to support the old J2EE components, you can deploy your old application into a new server and start to delete code. The benefits are obvious: you can delete > 60% of the code without any impact on the functionality. With the code you can also get rid off strange patterns, extensive layering and other strange “legacy” practices. This leads to reduction of the maintenance costs.

5. Describe the benefits of Java EE 6 to you in 120 characters.

Standards compliance, vendor independence, milliseconds and kilobyte deployment.

6. Advice for anybody who is looking at Java EE 6 for their next project ?

Reduce to the max. Concentrate on the business logic and not the technology. Write plain Java SE domain objects first (Unit-Tests of course before that :-) ), introduce EJB 3.1 / CDI facades later. Don’t even try to use everything what is offered by Java EE 6. But before you start to implement you own solution, look at Java SE 6 first, then Java EE 6. You will be surprised how much functionality is already there.

7. What new features you’d like to see in Java EE 7 ?

Further simplification and unification of the APIs would be great. The synergies of JSF 2, EJB and CDI could be a lot more leveraged. A more natural use of java.util.concurrent in Java EE would be also interesting (e.g. injection of Executors). For all of my cases @Asynchronous worked perfectly, but Executors seem somehow to fascinate developers :-)

JPA 2.0 could be also extended with some useful features like support of resource injection (EntityManager is the most important) into JPA-entities. Its a controversial topic – but really important for projects. Also better support for stateful environments would be nice.

I would also expect a standardized JAX-RS client. Something like jersey, but with javax.ws.rs. prefix :-)

I’m really surprised, that actually no-one really complains over the really old JMS programming model (1997). This spec could be drastically simplified. A plain injection of a simplified queue or topic would be sufficient for > 80% of all cases.

Are you using, consulting, training, authoring books, etc in Java EE 6 ? Drop a comment on this blog and I’ll line you up for the Q&A session :-)

The Java EE 6 hub is your key resource to learn all about the technology.

And you can always try all Java EE 6 features in GlassFish.

Technorati: javaee6 community feedback adambien glassfish v3

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Related posts:
  1. TOTD #137: Asynchronous EJB, a light-weight JMS solution – Feature-rich Java EE 6
  2. wsmonitor (Web Services Monitor): A light-weight SOAP and HTTP Traffic Monitoring tool
  3. LOTD #17: Sun GlassFish Enterprise Server Administration and Deployment Course – SAS 4455
  4. TOTD #120: Deployment Descriptor-free Java EE 6 application using JSF 2.0 + EJB 3.1 + Servlets 3.0
  5. TOTD #32: Rails Deployment on GlassFish v3 from NetBeans IDE

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress