Comparing Web Frameworks: Presentation Outline
My Comparing Web Frameworks outline is due to the ApacheCon Planners today. I spent a couple of hours putting it together this morning and I'm mostly done. In reality, I know that I won't cover the things that everyone wants to know. In an ideal world, I could simply target the presentation towards people like me: they know Struts but want to learn more about the other frameworks. Before diving in, they want to know some things to watch out for.
The problem with doing that is writing for people like me sometimes backfires. I'd like to make it an advanced presentation, but I'm not an authority on all 5 frameworks - so that seems a bit far fetched. However, if I could add Tapestry and JSF support to AppFuse in the next two weeks - I'd have a lot more experience to refer to. But that ain't gonna happen - the first update chapter for Spring Live is due next week. OK, enough rambling - here's the slide titles I've come up with. So far, it's 22 slides and shouldn't grow any since it's supposed to be finalized when I submit it.
- Who is Matt Raible? My background, open source involvement, etc. Trying to give myself some credibility.
- Framework Experience: Long time Struts user, used Spring since end of last year, developed apps with other three this summer. AppFuse supports Struts, Spring MVC and WebWork; Tapestry and JSF coming before end of year.
- Meet the Candidates
- Struts: Pros and Cons. Pretty much a standard, lots of examples, HTML tag library kicks ass. ActionForms kinda suck, can't unit test (only StrutsTestCase integration tests), Mailing list is swamped.
- Spring MVC: Nice lifecyle (for overriding binding, validation, etc.) integrates with many view options seamlessly, IoC for easy testability. Not widely used, requires lots of code in JSPs, almost too flexible (no parent controller for SimpleFormController and Controller).
- WebWork: Simple architecture, tag library easy to customize, interceptors are pretty slick. Documentation only recently written, few examples, client-side validation needs work.
- Tapestry: Very productive once you learn it, templates are HTML (great for designers), healthy project. Documentation very conceptual, rather than pragmatic (lots of "read the book"). Steep learning curve, few examples. Impossible to test - page classes are abstract.
- JSF: J2EE standard (lots of demand and jobs), fast and easy to develop with, rich navigation framework. Tag soup for JSPs, a bit immature (doesn't come with everything), no single source for implementation.
- Controllers and Views: Show controllers for all 5 frameworks and template page (JSP/HTML) for forms. Give URL to download sample apps.
- List Screens: How easy is it to integrate a sortable/pageable list of data? Struts, Spring and WebWork can use tag libraries like the display tag, value list or data grid. Tapesty has contrib:Table. JSF has dataTable component that requires custom logic for sorting (let me know if this has changed).
- Bookmarking and URLs: Struts, Spring and WebWork give you full URL control. Tapestry has ugly URLs. JSF does a POST for everything. Conclusion: first 3 play nicely with container-managed authentication. Tapestry doesn't (although there's a patch for pretty URLs). JSF is not friendly to bookmarking.
- Validation: Struts and Spring MVC can use Commons Validation - a mature solution. I've heard it's architecture is ugly, but who cares - it works! WebWork uses OGNL which allows powerful expressions. Client-side support is new and maturing. Tapestry has robust validation w/ good messages out-of-the-box. JSF has ugly default error messages, but is the easiest to configure.
- Testability: Struts you can use StrutsTestCase, which requires web.xml and struts-config.xml. WebWork and Spring allow easy testing with Mocks. Spring has a spring-mock.jar that can be used for mocking the Servlet API with any framework (it's not Spring-specific). Tapestry is impossible to test because page classes are abstract. The argument I've hard is "you don't need to test them b/c they're so simple." JSF page classes can be easily tested and actually look a lot like WebWork Actions (except they don't extend anything).
- Success Messages: The easiest way to solve the duplicate-post problem is to redirect after doing a POST. Struts is the only framework that allows for success messages to live through a redirect. It's fairly easy to get i18n messages in a Struts Action. Spring has nothing "built-in" for success messages. Long classnames / method arguments make it kinda clunky to get messages. WebWork has the cleanest way to get messages using a simple "getText()" method. Both require a custom solution to make your messages live through a redirect. Tapestry requires you to throw an exception to redirect and it still doesn't redirect (I haven't solved the duplicate post problem with Tapestry). JSF requires lots of code to get a ResourceBundle, but you could use Spring's IoC to inject a "messageSource" bean, making it a lot easier. JSF requires a custom solution for messages to live past a redirect.
- Spring Integration: Supported by all, sample apps have examples (quick slide).
- Internationalization: JSTL's <fmt:message> tag makes it easy in all JSP-supporting frameworks. Too bad there's not a standard for getting bundles in controllers and setting messages. Struts, Spring and JSF encourage you to use one ResourceBundle for all messages while WebWork and Tapestry encourage separate files for each page/action. This strategy is probably better for large teams.
- Page Decoration: I used to be a huge advocate of Tiles (using it since August 2001). SiteMesh is much easier to setup and use. Tiles can be used in Struts, Spring MVC and JSF. SiteMesh can be used with all 5 frameworks. In fact, the sample app uses the same SiteMesh setup for all w/o changing a thing. SiteMesh requires no maintenance, Tiles requires you add entries to tiles-config.xml whenever you add a new page.
- Tools: Struts has lots of tools available for it and even frameworks built on top of it (i.e. Beehive's NetUI/PageFlow). Spring has Spring IDE which is really just an XML tool for validating your bean and their relationships. WebWork has none (that've been released), but it is on the roadmap. Tapestry has Spindle, which is great for code-level programmers. It doesn't do drag-n-drop, but it does validate relationships between files. JSF has lots - but all of them cost money and tend to hook into proprietary app servers.
- Business/Marketing: Struts has lots of jobs and is well-known in the industry. A lot of enterprise applications are based on it. Spring is getting more press, but mostly because of the framework's other features. Knowing the rest of Spring is more valuable than Spring MVC. WebWork is gaining ground, but it's still virtually unheard of on job boards. If you do get gigs using WebWork, it's likely word-of-mouth and you'll probably be working with some pretty smart people. Often used with Spring and Hibernate. Tapestry needs more marketing - no one has heard of it, hence no jobs exist for it. JSF is quickly becoming the most popular. Want to stay employed? Learn JSF. The best reason: so you can back up your arguments on why you do/don't like it.
Dice Job Count: Struts (1006), Spring (15 - not a very good name for searching, used "spring framework"), WebWork (14), Tapestry (9), JSF (147).
- My Opinion: You have to come to the conference for that . Slides should be posted following my presentation.
- Resources: Link and such for downloads, frameworks and tools mentioned.
Comments, suggestions, like it/hate it? Let me know. I expect to send this in in a few hours - so you'd better be quick!
Posted by Sekar on October 15, 2004 at 12:16 PM MDT #
Posted by angelo on October 15, 2004 at 12:18 PM MDT #
Angelo - I'll post my slides after the talk with my opinions. In reality, I need to integrate Tapestry and JSF into AppFuse before I can judge them all equally - so it might be awhile until I arrive at a "justified" opinion. ;-)
Posted by Matt Raible on October 15, 2004 at 01:12 PM MDT #
Posted by Winston Rast on October 15, 2004 at 01:52 PM MDT #
Some people, like me, have been using Colections in place of ActionForms, becuase Struts supports it. .V
Posted by Vic on October 15, 2004 at 02:41 PM MDT #
Posted by Ted on October 15, 2004 at 03:23 PM MDT #
Posted by David Channon on October 15, 2004 at 04:18 PM MDT #
Posted by Ken Yee on October 15, 2004 at 04:50 PM MDT #
Posted by Ken Yee on October 15, 2004 at 04:53 PM MDT #
Posted by Colin Sampaleanu on October 16, 2004 at 01:06 PM MDT #
Posted by Mike Youngstrom on October 16, 2004 at 06:08 PM MDT #
Posted by Mike Youngstrom on October 16, 2004 at 06:12 PM MDT #
Posted by Mike Youngstrom on October 16, 2004 at 06:55 PM MDT #
Posted by Peter Neubauer on October 18, 2004 at 12:54 PM MDT #
Posted by Jack Hung on October 19, 2004 at 09:15 AM MDT #
Posted by Howard on October 19, 2004 at 07:27 PM MDT #
Posted by Necrodome on October 20, 2004 at 07:46 AM MDT #
Necrodome - if you have the time, I'd learn Tapestry. If you don't (and you're not familiar with other frameworks), I'd learn WebWork (it's the easiest to learn). Of course, learning and using Struts will result in the best job. Even if you learn the other two, you'll still need to know Struts b/c there will likely be a lot of porting from Struts to Component Frameworks in the future.
Posted by Matt Raible on October 20, 2004 at 08:02 AM MDT #
Been reading your blog for a while. Never got to contribute before. As for nice urls, do you know about the urlrewrite filter by Paul Tuckey (http://tuckey.org/urlrewrite/) ?
Works quite well and plays nice with sitemesh (which you introduced me to).
Posted by Patrick Turcotte on October 21, 2004 at 05:21 AM MDT #
Posted by Matt Raible on October 21, 2004 at 07:25 AM MDT #
Posted by Jim Stuttard on November 26, 2004 at 09:26 AM MST #
Posted by Jim Stuttard on November 26, 2004 at 09:26 AM MST #