Dilbert, actual as usual

JSF (A love and hate story, endless yet)

When I first met JSF I was having another relationship. I had been for 2 years with Struts. In the beginning it seemed to me (Struts) dull and thorny (I had just had a long affair with PHP), but when I met its parents Validator and Tiles, I fell in love. I was convinced by their configuration-files-for-everything approach, and its action-oriented workflow seemed to be a natural way to develop MVC.

In a travel I was presented JSF, and the first sight couldn't be more half-hearted. I felt I was doing just the same, and with worse tag libraries. Furthermore, it was not alone, but came with Spring and IBatis, so breaking the ice was even more difficult. Thinking on components and events? What for?

Suddenly, a third one came into my way and everything turned clearer: Ajax. Everything made sense. A text field would never ever be an empty box until somebody presses a button. Now, a text field deploys suggestions, connects to the server to asynchronously validate itself, activates and disables page fragments... And if you want to develop this the good way, JSF is a must.

This is the beautiful part of every love story, but every good thing has a catch: JSF is a very limited standard in term of components (and I am not the only one who says it). JSF is only a framework you can use as basement for something really interesting. It was born in 2004 as Sun fix to the gap at presentation layer at J2EE, but it was not only until Ajax when people has invested on it.

Implementations (MyFaces, Sun RI, Facelets...), frameworks (Ajax4JSF, ICEFaces, Tobago...) and component libraries (RichFaces, Tomahawk, jMaki...) promise a lot, but managing to make them work together is often annoying. Bad documentation, incompatibilities, the need for betas, sandboxes, nightshots...

Despite it, I think JSF is the best choice for MVC if you want Ajax. More specifically, (MyFaces + Tomahawk (a must)) + (Ajax4JSF + RichFaces (really powerful)). First ones give an stable enough and comprehensive base set, and latter, the full power of Ajax.

P.D.: MyFaces won't stop. They've recently delivered 1.2. In the wiki there's a good amount of JSF, MyFaces and even integration with other libraries.

P.D.2: interesting graph on Ajax for different technologies.

It comes from a J2EE Framework comparative, really up-to-date.

DRY: brief guide to keep you dry

Some years ago a Bachelor teacher told us there's enough with a few principles to explain most nature phenomena. Osmosis, conservation of energy and a few others can model most of the things we see.

I think it happens the same with computing. In spite of the huge amount of languages, libraries and platforms there are, the grounds which make them good tools are very similar. Maybe the most important among them is "DRY principle": Don't Repeat Yourself. Repeating implies more work (a good programmer should be lazy), duplicating errors, reducing code mantainability, making changes harder... Here it comes the great sentence: "Every time you copy-paste, Lord kills a kitten".

My work environment for the last years has been J2EE, and I use the following tools to keep me dry:

Hibernate: minimizes data access code.
Hibernate Validator: takes advantage of persistence specification to check form data correctness and shows user error messages. If you don't use Hibernate you should have a try on Commons Validator.

Templating and cutting up pages, whether Tiles (a must if you still use Struts) o Facelets (best reusing with JSF).

Intensive CSS for presentation. There's no good at "improving presentation with CSS". The best thing you can do is composing web pages structure with XHTML independently from presentation, delegating 99% to CSS (1% left is for IE hacking).

Ideas + Software Engineering

* Software developing blog.
* @author Juan Ignacio Sánchez Lara
* @version v0.00
* @since 070725
* @see
public class ISE extends Blog implements SoftwareDeveloping, J2EE {

//TODO: funny comment for first post.

//FIXME: missing funny jokes libraries