Feature:

Adam Bien prepares for the near future of Java EE

By James Denman

TheServerSide.com

The current business environment demands that enterprise application developers provide flexible, integrated applications. Java EE may well be the most important tool in the server-side developer's collection. Java is built on a solid foundation of object-oriented programming. Java EE 6, the current version of Java EE, has honed these concepts to a high degree. Much of the functional drudgery inherent in application development is abstracted away, leaving developers more time and focus for the important business logic aspects of their applications. Java EE 7, and eventually Java EE 8, will no doubt strengthen the platform even further.

In TheServerSide.com's virtual Java University, Java Champion Adam Bien presented a compelling session on the importance of Java EE now and the direction Java development is headed in the immediate future. Bien is not only a Java Champion, but also a Java Rock Star. His diligent efforts have been invaluable both in promoting and in directing the course of Java development. The following information is taken directly from Bien's presentation.

Core concepts

By focusing on convention over configuration, Java EE developers are able to significantly increase the portion of their time devoted to productive coding by minimizing the need for repetitive configuration. This ties in well with context dependency injection (CDI). CDI extended out of existing dependency injection concepts and helps automate the process of building and fetching references between components. Bien says the synergy between strong conventions and dependency injection is very strong and has allowed him to produce Java EE projects that have no xml configuration and no EJB jars.

Bien also discusses the complementary concepts DRY (Don't repeat yourself) and KISS (Keep it simple, stupid). According to Bien, the best practices with J2EE were to duplicate metadata across similar objects. "In practice," said Bien, "you end up with many layers with nearly identical objects, which were really hard to maintain. This is no longer necessary in Java EE 6 and is in fact an anti-pattern." To avoid complication, Bien suggests focusing on domain logic first. "Start with domain objects, provide a clear boundary and the boundary will provide services to the outside world." This approach will help keep it simple.

Bien also enjoys Java EE 6 for its out-of-the-box experience and enterprise readiness. "If you start with a plain old Web container like Tomcat," he says, "it comes with some monitoring capabilities, but these are nothing compared to Java EE 6." Most Java EE6 application servers now provide very good monitoring, management and deployment capabilities.

Application servers are also much easier to set-up now than they were in 1995. According to Bien, he is able to download an application server, extract it from its archive and quickly deploy that first application. "You can create your environment in about 10 minutes," he says, "and this is what I do in all my workshops … without Java EE, I wouldn't be able to deliver a workshop in one day with the whole setup."

Results and consequences

Bien discusses the effects of Java EE 6 in terms of productivity, maintainability, architecture, build, operations and developers. He says the impact of Java on productivity is clearly beneficial; Java EE streamlines the development process and allows developers to zero in on what matters. "If you just focus on business logic, and you don't have to maintain and create the bloat of superfluous patterns, you will be a lot faster," says Bien.

Maintainability, Bien argues, is possibly the most important aspect of application development. Enterprise clients, he reasons, aren't looking for Java experts because their applications are difficult to develop, but because they are difficult to maintain. Bien says "Most of my contracts are modernizations where we try to simplify the development, and Java EE is just great for that."

He predicts that architecture will also simplify and focus more on business architecture than on infrastructure needs in the near future. Bien notes that there are already industry standards for builds right now. For most projects, his team uses Maven, but Gretel and Ant also come up. As a side note, Bien recorded a YouTube video demonstrating how to set up a Java EE 6 project with Maven in just about three minutes.

There are also benefits for both developers and operations, according to Bien. On the operations side, Bien focused on better ways to monitor, manage and deploy applications. For developers, Bien focused on JSR documentation that can be downloaded and easily searched for specific development questions. He stressed that learning garnered from JSR documentation would apply to any application server.

Tips for even better productivity

"XML is history," says Bien, "You don't need xml for configuration of your references or for infrastructure configuration." In fact, when Bien finds xml in a project written in Java EE 6 or later, he thinks of XML as "a bad smell." XML generally contains repetitive metadata that also resides in its normal place in the code.

Bien says to focus on achieving a ratio of 90% domain code to only 10% infrastructure code. A typical J2EE application required many more infrastructure patterns and would end up being 70% infrastructure and just 30% business logic. Migrating to Java EE 6 or later will let you erase a lot of the infrastructure code and give a boost to productivity.

According to Bien, many developers find Java EE 6 complicated and difficult to learn because there are so many annotations. Yet he claims that Java EE has a rather flat learning curve. One starts out with a few of the most important annotations that let you "build whatever CRUD applications you would like to. Then you can just learn the rest as you go."

21 Sep 2012

Related Content

Related Resources