No Such Thing As Web 1.5

Originally published on LiveJournal, 12.24.07

I’ve absolutely had it struggling to make JSF work for me. It works only for very trivial examples, and is so complex that each little tweak can take many, many hours of work (if it indeed works). Also, what it provides is, when it comes down to it, half-assed. On the one hand, the user gets what looks like a “web 1.0” application, but on the other hand, it makes extensive use of JavaScript, and utterly breaks regular browser behavior, such as bookmarking, standard URLs, and even the back button. There are half-assed extensions such as ajax4jsf that allow for more “web 2.0” behavior, but they do not fix those serious problems.

At first, JSF seemed like a good idea to me for various reasons. First, because its component-based approach allows clean separation between parts of the user interface, without getting bogged down by the HTTP cycle. Coupled with Facelets, you are also entirely free of the JSP engine. This concept is still JSF’s strongest selling point (Tapestry also has these selling points, by the way, but I won’t discuss here why I didn’t go with Tapestry). However, developing JSF components ends up being an enormous pain in the ass. The mechanisms which make JSF so powerful in this regard require a lot of developer work, and are difficult to test. Second, I was hoping JSF would allow for light, almost-web-1.0 applications, which could nicely downgrade to an environment without JavaScript (think of how Gmail can work in both modes). I found, however, that the two main implementations of JSF (Sun and Apache) simply can’t function without JavaScript. It seems silly to me, then, to require JavaScript and make such little use of it. Third, I was hoping that the next version of JSF would fix these problems. Especially, there was talk about simplifying component development. It seems, however, that JSF is suffering from bad version 1 syndrome: because it’s not good enough, people aren’t embracing it enough, and because people aren’t embracing it enough, there’s little effort to improve it much. The industry is clamoring for more AJAX, and JSF is meant specifically to be a server-side alternative to AJAX (in that respect, ajax4jsf is especially abominable), and as such is more a curiosity than a solution.

So, I was at a crossroads: either go with a web 1.0 solution, using simple HTTP-cycle handlers (such as tried-and-true Struts — I will not write a pure JSP application ever, ever again!), or go full web 2.0, abandoning the HTTP cycle and treating the web browser like a thin client.

(There’s actually a third option: the Google Web Toolkit (GWT), which has built-in solutions to a lot of the problems of JSF. It’s approach is different from both server-side (JSF) and client-side (AJAX) solutions, in that it makes the difference between client and server transparent for the developer, with the user getting a reasonable, automated mix of both. However, it’s a rather monster of a solution, and utterly locks you into its unique paradigm.)

I chose, then, to go full and extreme web 2.0. As such, the entire application is in a single URL, and all dynamic aspects of the user interface are handled entirely in the client, rather than going the route to the server and back. This is faster and more responsive from the user’s perspective. It does make bookmarking work a bit differently, but it’s something that can be handled clearly enough for the user. (For example: an explicit option to “show a direct link to this article” or something similar.) The problem with such an approach is that so much depends on the quality of the platform, and how well it handles the many quirks and differences between browsers. If you have a problem in that respect, development can come to a halt for weeks as you try to fix it, test it on various platforms, find out your fix breaks another platform, etc. etc. I’ve been there before, which is why I didn’t go full web 2.0 in the first place. From a developer’s perspective, web 2.0 was a quality and security nightmare for years. Things have changed, however, and we’re seeing more and more major web 2.0 applications that work quite well (see Meebo, for example), as opposed to a trivial examples or enhancements of web 1.0.

And so, I gave Ext a chance, out of pure desperation with JSF, and found the recent version 2.0 of it to be very complete. Within a week, I managed to create a very powerful frontend, which months of work with JSF/Facelets couldn’t provide. I needed no JavaScript trickery. Ext is also very well documented, and features extensions for Eclipse which make it a joy to work with. The only limitation I currently found is themability: it’s very difficult to create custom themes, pretty much locking you into the default (though pretty) look. Some users have created variants of this default, but they’re nothing more than color shifts. A more significant change would take significant work and testing. Still, I’m sure I’ll be able to create a great application with Ext as the frontend, and my own home-grown kick-ass backend. Hooray!