December 19, 2005

Tapestry or JSF

I admit it. In two years, from when I started evaluating best web application frameworks for my current (big) employer and later on finishing two JSF based applications, I've become a JSF guy. It's been fun to learn it and after some years of hacking with Struts, JSF felt it was light years ahead. However, the journey hasn't been without considerable uphills and struggles with oddities in JSF spec and implementation. Mostly, I've been okay with dropping to request/response level and working around with problems like loosing messages with redirect, filter interaction with JSF lifecycle and so on, but recently I've been more and more wary about performance and scalability of JSF. And don't get me wrong. With any decent architecture, the bottleneck is almost always the database, so most of the time it doesn't matter if supporting a better UI frameworks takes a few more CPU cycles or a little bit more memory. Furthermore, if you only plan to support only a few hundred simultaneous users (for perhaps a few thousand or tens of thousand total users) any single box (Opteron :) server can handle the load just fine. (Proved by back of the hand calculation: average time to serve a JSF page with database access around 10-50ms -> ~30 request / sec -> ~100 000 request / hour).

However, with the raise of AJAX (you know, it's NOT news but I've been suckered into the hype and let's just stick with the AJAX name so everybody knows what I'm talking about) and exponential increase in the amount of HTTP requests hitting the server, the careless object creation and memory consumption in JSF has started to worry me. Meanwhile I keep reading studies about performance of hyper-cached Ruby on Rails and scalability of simple PHP and have "seen the light" with custom IoC frameworks such as Spring. I've always been doubtful about JSF promise of multiple renderers to support any given client. All the additional built-in flexibilty in JSF adds unnecessary layers of abstraction with little benefits if most people will still use it for rendering HTML. In addition, having made a few JSF components, I can only note its way too cumbersome and error-prone to foster lively environment for custom components.

Enter Tapestry. Originally, in my evaluation of web application frameworks, I dismissed it not because of lack of features, but its too small userbase. JSF seemed to offer functionality in-par with Tapestry, tool support and additional extensions points. Tapestry is much more streamlined and focused than JSF. Building a component tree is simpler because you cannot add or remove components to it runtime, which in turns makes it possible to use cache aggressively and allows for much simpler architecture: everything you need, nothing less, nothing more. But Tapestry is very much one man show. Not to say it's necessarily bad, the biggest innovations often comes from a sole contributor that has the vision, but even still, how viable option Tapestry really is in the future? With that in mind, I started doing *a lot* of research, comparing Tapestry to JSF and other frameworks. I read everything I could find from the web, the mailing lists, the discussion, the articles and whatever I could get to from Google and via links posted as comments in tiny little blogs. Also with countless times, I abandoned Tapestry for whatever reason, but always came back to it.

I actually wanted to write this blog entry for others to make their research easier. The five best comparative studies on Tapestry and JSF I coud find are:
http://www.theserverside.com/articles/article.tss?l=JavaOne_Day4
http://www.theserverside.com/articles/article.tss?l=JSFTapestry
https://equinox.dev.java.net/framework-comparison/WebFrameworks.pdf
http://wiki.osafoundation.org/bin/view/Projects/WebFrameworkComparison
http://sandbox.sourcelabs.com/kosta/web_ui_compare/readme/index.html (with some performance comparisons!)

Of course, not to forget Howard's own comments on the issue. He's biased, naturally, but his opinions are well justified:
http://howardlewisship.com/blog/2005/02/tapestry-jsf-and-fud.html

When I started with Tapestry, I used all kinds of starter apps: from clean Tapestry project and Tapestry sample apps to Raible's AppFuse with Tapestry. However, by far the best I've seen is Trails. The efficient use of annotations and auto-generated pages do help and increase the speed of development a lot. Now the concept in JSF Facelets as well as Shale Clay are very similar to Tapestry, but it might take a long while either project reach the maturization level of Tapestry/Trails. I've seen some performance tests and comparison with Tapestry, but not a single good one for JSF. Anyone? Anyway, for now at least, I'll be using Trails and reconsider JSF-based solutions once (and if) they catch the lead of Tapestry.

Posted by thoughts at December 19, 2005 02:29 PM | TrackBack
Comments

Thanks for this review and sharing your research, IT IS MUCH APPRECIATED!!

I came from the JSF camp and found some things that I absolutely couldn't live with (i.e. spending time with a screen designer to learn all of the JSF tags and then telling them they can't imbed html inside of tags but must instead use <f:verbatim/> - YUCK!)

The feeling I get with Tapestry is that it is a developers framework vs. a big companies (Sun, IBM) specification. It aims to "get'r done" vs. having a world of possibilities and having to learn what to pick.

The only dislike I have found with both packages is that the people writing the documentation seem to be the same people developing the code, and thus assumptions are made which many times leaves me without a clue as to how to proceed (i.e. right now I can't figure out how Tapestry does it's replacement of the deprecated Visit method of BasePage. I checked the session state page and it tells you how to set it up, but doesn't give example Java code to show how to use it).

Anyways, I digress. . .

I hope to be posting some of my Tapestry vs. JSF findings on my blog at http://mowyourlawn.com/blog/ so feel free to link to me :-)

Posted by: Aaron Bartell at December 29, 2005 06:54 AM

have you looked at JBoss Seam and it's ability to manage business objects via EJB 3 and uses JSF for the view-- some of the demos are powered by Facelets.

Posted by: Andrew Houser at January 2, 2006 06:40 PM

To Aaron: Argh. I don't have a blogroll. I should. I guess I have to add it with a next blog software update. I just wish adding plugins to MT was as easy as adding them to Firefox (SessionSaver rules :)

Posted by: Alphageek at January 8, 2006 10:57 PM

To Andrew: Yes, I've done cursory reading on Seam, but as it was, I didn't even try the examples. Having used JBoss in the past, I've got somewhat mixed feelings about them. I like that they keep improving the state-of-the-art, but at times I just have serious doubts of the direction they are going (e.g. AOP comes to mind). But it's been a while since I last really worked on JBoss, maybe it's time for re-evaluation.

Posted by: Alphageek at January 8, 2006 11:06 PM

Just to add to this, there's a pretty good (and intelligent, at-least-not-yet-degenerated-to-a-flamewar like most Serverside topics) discussion going on at
http://www.theserverside.com/news/thread.tss?thread_id=38407#196558 after Howard's Tap4 announcement. Definitely worth reading!

Posted by: Alphageek at January 11, 2006 11:34 AM
Post a comment









Remember personal info?