Friday, March 24, 2006

ADF Faces – First Impressions

The much anticipated JDeveloper 10.1.3 was released at the end of January 2006 and definitely lived up to expectations among the JDeveloper community. The slick new interface boasts some really great features including significant enhancements in the code editor and overall feel of the IDE.

So what about Faces? ADF Faces is based on the JavaServer Faces industry standard framework. An open source implementation of JavaServer Faces called MyFaces has been [donated] to the Apache Foundation by Oracle.

The persistence layers offered by JDeveloper are ADF Business Components and Toplink. Oracle has released fully working example application called the SRDemo which is a simple service request system. The aim of the SRDemo is to solve most of the design woes faced by any developer starting out on green fields J2EE web application. SRDemo is written in ADF Faces (JSP) using TopLink and use J2EE container security for authentication and authorisation.

Why TopLink? TopLink is a POJO (plain old java object) based approach to creating an object-to-relational persistence layer. TopLink uses and EJB (Enterprise Java Bean) session façade and provides a full declarative (XML) persistence layer defined in what’s called a TopLink map. One really nice feature of TopLink is named queries; Named queries encourage the reuse of TopLink entities by exposing different operations on the entity (such as setting or changing conditions) by exposing methods through the Session Façade bean. I was impressed with TopLink, because it has some original and well implemented ideas. The POJO approach unpacks all the complexity which is hidden in ADF BC, which can be a bit daunting when starting out with the TopLink framework.

There are some significant improvements with ADF BC including some out-of-the-box goodies which either didn’t work or were a headache to implement in 10.1.2. Read-only view objects are great as well as dynamic view criteria. For those coming from an Oracle Forms or non-OO background, ADF BC is an easier transition than TopLink and is a mature and robust framework to go with.

The actual ADF Faces user interface can be implemented in two ways, a JSP (Java Server Pages) or a JSPX (XML Document). The faces lifecycle and faces-config.xml implements the controller layer providing the interaction between the model and view layers. ADF Faces provides an abundant set of UI components which give a consistent looking and rich user interface. Strong support for expression language makes binding components to the model a breeze. The backing bean and managed bean concept has also greatly simplified managing events.