Live from TSSJS – Ajax and JSF with Max

Live blogging from TheServerSide Symposium on the final day, attending “Ajax Applications with JSF 2 and New RichFaces 4” presented by Max Katz.  Max is presenting a talk on Ajax, which has been added to JSF2, as well as integratin with RichFaces 4.  Max will be part of a client-side panel in the next set of talks with myself, Cameron McKenzie, and Bear Bibeault in the main ballroom.

Attendance has been significantly reduced today as many people, CodeRanch staff included, have started flying back home.

1.  JSF2 New Features
Max lists some of the new features in JSF2:

  • Facelets
  • Compsitie components
  • Implicit Navigation
  • Bean validation
  • Basic Ajax – Focus of the talk

2.  Ajax Support
Ajax support in JSF2 has been added via f:ajax tag.  Max presents some code examples that include event handling for the Ajax tags.

3.  Where are the rich JSF2 components?
Max focusses on JSF2 as a framework for developing extensive widgets and rich UI, but does not provide them.  In other words, to use JSF2 in practice, you will need to also include a rich framework, built on top of JSF2, as part of your application.  The rest of his talk is focussed on RichFaces 4, a rich JSF2 framework with customizable/skinnable widgets.

4.  RichFaces 4
RichFaces 4 has basic support for JSF2, so it is the first cross-over transition.  The CR1 is available and the main release is slated for the end of March or early April, so as soon as 1-2 weeks.  The RichFaces 4 tag is available via a4j:ajax.

5.  What’s new in RichFaces 4?
New version relies entirely on jQuery in JavaScript.  Redesign for semantic HTML principles.  Also includes server-side and client-side performance optimizations.  Finally, a lot of code clean-up and review was completed by the RichFaces team.

From a deployment perspective, it supports publishing to Google App Engine as well as Amazon EC2 Cloud.

Conclusion
Max spent the rest of his talk presenting individual facets of the RichFaces 4 API.  It was a little dry if you don’t have a strong foundation in RichFaces, but still educational.  The client side valdation, based on bean validation, looked particularly useful.

Live from TSSJS – Tips for Hibernate with Patrycja

This morning I’m live blogging from TheServerSide Java Symposium 2011 at the breakout “Anti-Patterns and Best Practices for Hibernate” presented by Patrycja Wegrzynowicz.

Making Good Software
Patrycja’s primary goal is to “understand what makes good software good and bad software bad” and she is working to formalize these concepts.  She would like to develop automated code tools that can detect ahead of time whether or not code contains anti-patterns and potential performance issues.

For those not familiar with the concept, an anti-pattern is an obvious or common strategy which leads to degraded or counter-intuitive performance.

Is Java Fat
Patrycja asks the question “Is Java fat/slow?”.  She claims the language is not, in fact, slow, but that some of the ways in which we program objects is slow, which I agree with strongly.  For example, I have seen computational entensive code that improved in memory/speed by large degrees by relying on primitive variables, rather than more complex objects, in part because “new” is considered expensive in Java.

Automated Code Analysis
Requires large knowledge base.  Patrycja has been researching semantic code query system which focusses on behavior, not just structure.

Conclusion
Patrycja says that proper usage of hibernate is tricky.  Transactional issues and correctness of code under various scenarios.  Best solution may be combination of Hibernate and JDBC.

I liked that fact that she stepped back and indicate Hibernate, by itself, isn’t perfect.  I agree with her take that the best systems are often hybrid systems that take advantage of the ‘low hanging fruit’ of both worlds, and avoid the pitfalls of each.

Live from TSSJS – Lightweight J2EE with Adam

For my final TheServerSide Java Symposium breakout session for the day, I am attending “Lightweight Application Development with Java EE 6” presented by Adam Bien.  Adam’s talk is in part an attempt to bring former J2EE developers (myself included) back to the table who may have been driven off by previous, heavy-weight J2EE implementations, such as J2EE 1.4.

Adam spends most of his presentation actually building a simple Java EE 6 application on the fly, using Casino/Police/Mafia metaphor (since this conference is in Las Vegas).  I’ll try to capture the highlights in this blog, but the code itself says volumes about how simple to use Java EE 6 has become.  He develops in NetBeans IDe 6.9.1 with Glassfish as a web server, deploying everything as a WAR.

1.  Simplifying Code with Annotations
Java EE 6, like Java EE 5 before it, solves a lot of complexity and deployment issues through Java 1.5’s creation of annotations.  Adam shows a code example of a Stateless session bean is essentially just a POJO with the @Stateless annotation.  The only required import is “javax.ejb.Stateless” for the annotation to reference.

2.  Interceptors
Java EE 6 supports @Interceptors that redirect business methods for a better separation of POJOs and business logic.  Serves as a filter for business methods.

3.  Dependency Injection
The @Inject tag allows you create instances of related objects that live as long as the parent module.  Easy to create events and inject them into classes.

4.  Qualifiers
Adapted from Spring, helps control event ordering as far as which observer gets the message.  The annotation @Qualifier is used on the class level with a @Retention and @Target parameters.  The listener can then be updated to only listen to events of particular types or values.  Furthermore, they can be use for filtering on events which is useful for batch processing.

5.  Messaging
Java EE 6 supports @Asynchronous annotation for creating messaging handlers.

6.  Interfaces
Similar to previous versions of J2EE, you can define an interface for a session bean and use references to the interface instead of the concrete class.  Compiler throws an error if you try to inject an interface with no concrete implementation.

7.  J2EE and Spring
Adam recommends not mixing the two, and building entirely in Spring xor J2EE 5 or 6.  The features are very similar between the two and mixing them can be complicated.  One of the major new features of Java EE 6 is REST integration.

Conclusion
Adam did not present any slides, but built a quite impressive Java EE 6 application on the fly with very little code.  Everything he built deployed instanteously on his MacBook, and was accessible from the web browser right away.  Adam pointed out not all computers or operating systems build as quickly.

I asked Adam if he would be posting his code online since it was quite educational.  He said he will once he is back in Germany.