Question

Apache Wicket ( http://wicket.apache.org/ ) and Apache Tapestry ( http://wicket.apache.org/ ) are both component oriented web frameworks - contrary to action based frameworks like Stripes - by the Apache Foundation. Both allow you to build your application from components in Java. They both look very similar to me.

What are the differences between those two frameworks? Has someone experience in both? Specifically:

  • How is their performance, how much can state handling be customized, can they be used stateless?
  • What is the difference in their component model?
  • What would you choose for which applications?
  • How do they integrate with Guice, Spring, JSR 299?

Edit: I have read the documentation for both and I have used both. The questions cannot be answered sufficently from reading the documentation, but from the experience from using these for some time, e.g. how to use Wicket in a stateless mode for high performance sites. Thanks.

Was it helpful?

Solution

Some relevant differences as I see them:

  • Tapestry uses a semi-static page structure, where you can work with conditionals and loops to achieve dynamic behavior. Wicket is completely dynamic; you can load components dynamically, replace them at runtime, etc. The consequences of this are that Tapestry is easier to optimize, and that Wicket is more flexible in it's use.
  • Both frameworks are roughly equally efficient in execution, but Wicket relies on server side storage (by default the current page in session, and past pages in a 'second level cache' which is default a temp file in the file system). If that bothers you, think about how many concurrent sessions you expect to have at peak times and calculate with say ~100kb per session (which is probably on the high side). That means that you can run roughly support 20k concurrent sessions for 2GB. Say 15k because you need that memory for other things as well. Of course, a disadvantage of storing state is that it'll only work well with session affinity, so that's a limitation when using Wicket. The framework provides you with a means to implement stateless pages, but if you're developing fully stateless applications you might consider a different framework.
  • Wicket's goal is to support static typing to the fullest extent, whereas Tapestry is more about saving lines of code. So with Tapestry your code base is likely smaller, which is good for maintenance, and with Wicket, you much is statically typed, which makes it easier to navigate with an IDE and check with a compiler, which also is good for maintenance. Something to say for both imho.

I have read a few times by now that people think Wicket works through inheritance a lot. I would like to stress that you have a choice. There is a hierarchy of components, but Wicket also supports composition though constructs like IBehavior (on top of which e.g. Wicket's Ajax support is built). On top of that you have things like converters and validators, which you add to components, globally, or even as a cross cutting concern using some of the phase listeners Wicket provides.

OTHER TIPS

REVISED after studying Tapestry 5.

Wicket's goal is an attempt to make web development similar to desktop GUI one. They managed to do it really well at the expense of memory usage ( HTTPSession ).

Tapestry 5's goal is to make very optimized (for CPU and memory) component oriented web framework.

The really big pitfall for me was responses "Wicket supports stateless component!" to the arguments "Wicket is memory hungry". While Wicket indeed supports stateless components they are not "a focus of Wicket development". For example a bug in StatelessForm was not fixed for a very long time - see StatelessForm - problem with parameters after validation fails.

  • IMHO using Wicket is a bit eaiser until you are going to optimize/ fine-tune web application parameters
  • IMHO Wicket is harder to study if you have programmed web applications and want to think in terms of request processing
  • Tapestry 5 automatically reloads component classes as soon as you change them. Both frameworks reload component markup.
  • Wicket forces markup/ code separation, Tapestry 5 just give you this ability. You can also use less verbose syntax in Tapestry 5. As always this freedom requires more cautions to be taken.
  • Wicket's core is easier to debug: user components are based on inheritance while Tapestry 5 user components are based on annotations. From the other side that could make transitions to the future versions easier for Tapestry then for Wicket.

Unfortunately Tapestry 5 tutorial does not stress that Tapestry code example like 't:loop source="1..10"...' can be a bad practice. So some effort should be put into writing Tapestry usage conventions/ good practices if your team is not very small.

My recommendations:

  • Use Wicket when your pages structure is very dynamic and you can afford spending 10-200 Kbs of HttpSession memory per user (these are rough numbers).
  • Use Tapestry 5 in cases when you need more efficient usage of resources

I think Wicket is a simpler framework to use.

Also, Wicket does allow for class reloading via your IDE's hot-code replace system. This is all that is required for Wicket to run off modified versions of a currently running application's classes. The usual restrictions apply for hot-code replace, such as having to run in Debug mode (Eclipse) and not being able to change structural aspects of a class (i.e. class name, changing method signatures etc...).

I don't like the Tapestry programming model and I know of many developers leaving Tapestry because of too much changes and incompatibilities in development. See: http://ptrthomas.wordpress.com/2009/09/14/perfbench-update-tapestry-5-and-grails/

Wicket is very good web framework. Best from all what i'm know. I'm use it since version 1.3 and always get what i'm want. Wicket has excellent integration with Spring - just use @SpringBean annotation in you code to inject any spring bean to your classes.

Try http://incubator.apache.org/click/ . It is amazing java web framework. Some people call it “Wicket made right” ;-)

As I said when 4.1 was the official stable release:

You should take a very good look at the development history of Tapestry before committing to use it. Tapestry has done a lot of non-compatible upgrades, with no continuation of support of older versions. Patches to 4.1 are not processed anymore within a reasonable timeframe. That is in my point of view not acceptable for the official stable version.

Committing to use Tapestry 5 means:

you should become a committer; you need to keep up with all new development, abandon old versions as fast as possible; maintain stable versions yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top