I’ve spent much of my spare time in the last three months refactoring code for the site fantasy-f1.net (which is the main reason why the blog has remained relatively quiet). The new year briongs with it new challenges and familiarity with a new JSF component library, PrimeFaces, which I’m loving.
Much of the back end code has origins that can be traced back as far as 2003 and this is the second time I have returned to the code base. On each occasion the structure and quality of the code improves, and test coverage increases.
On the first occasion the primary objective was to replace a home-rolled object relational mapping component with Hibernate, and to replace hard-wiring of components with Spring. This was a relatively minimal exercise and didn’t take advantage of all the Spring and Hibernate features it should have; in addition much of the code remained Java 1.4.
This time around the changes are in the same area but are more invasive (and beneficial). The DAO layer has been re-written on top of a base DAO, making use of Java 5 generics, and full use of Spring including transaction control has been implemented. Along the way I’ve ditched Ant for Maven, Subversion for Mercurial, and implemented continuous integration with Hudson. New code uses improved and tighter design patterns that increases my productivity and simplifies testing.
All of this has finally allowed me to move on to the rewrite of the presentation tier. The existing software uses Apache Struts 1.3 and no Ajax. Introducing Ajax components to a Struts-based application did not appeal, so the new UI is JSF 1.2 based. A trip to Devoxx allowed me some time to finish putting together the ‘breakthrough’ code – the minimum amount of infrastructure required to build some initial pages.
The initial UI is making extensive use of a relatively new component library, PrimeFaces, which is currently an RC (but going production any day now). PrimeFaces gets a big thumbs up from me because of the ease with which asynchronous postbacks, and page updates, can be achieved. JavaScript is tremendously difficult to debug, and the big plus with PrimeFaces is that there is no need to even be aware of the JavaScript element to what is required. A second wave of UI development is scheduled for Summer 2010 which will see the site embrace many more of the PrimeFaces components, to the benefit of the site and its users.
The exciting thing for me – beyond seeing my long-standing F1 web site get a fresh new look and lots of great features – is that the knowledge I come out of the project with. The best thing about PrimeFaces is that it will allow me to very quickly put together highly functional and visually impressive demo web sites and web applications. PrimeFaces contains rich components that have a highly abstracted programming model and sensible defaults, so building a good-looking, functional and dynamic UI is now a relatively trivial process.
The PrimeFaces site has an impressive component gallery which shows what can be done with the individual components – my aim is to establish a demo area on this site where in the next 12 months I will put up prototype applications using PrimeFaces.
3 comments
Cagatay Civici says:
January 19, 2010 at 08:56 (UTC 0 )
Hi Phil,
Do you mind if I add your great comments on PrimeFaces to the testimonials section in PrimeFaces.org?
Cagatay
Phil says:
January 19, 2010 at 10:02 (UTC 0 )
No, by all means do so. Please include a link to this blog entry.
Cagatay Civici says:
January 19, 2010 at 11:27 (UTC 0 )
Thanks for the support Phil. See you in forum