Difference between Apache Tapestry and Apache Wicket
Asked Answered
B

8

47

Apache Wicket ( http://wicket.apache.org/ ) and Apache Tapestry ( https://tapestry.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.

Breland answered 18/3, 2009 at 8:23 Comment(3)
JFYI, I have revised my answer a lot.Sextans
I would personally avoid Tapestry for the reason that its tends to get completely rewritten with every major release, and it's rarely backwards compatible with previous versions.Nonrestrictive
As of version 5 this should not longer be an issue - version 5 has been built with future extensibility in mind.Jeaninejeanlouis
R
41

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.

Roath answered 13/8, 2009 at 18:18 Comment(2)
"...your code base is likely smaller, which is good for maintenance" -- Are you sure? Experience shows that it's often the opposite. For the same amount of complexity and the same quality of code, a verbose code is usually more maintainable that a terse one. To achieve tersity, you need magic and corner-cuts.Lithea
@IOranger that can certainly be the case. Depends on how 'smaller code' is supported. Not all magic is bad, but it can certainly backfire.Roath
S
36

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
Sextans answered 18/3, 2009 at 13:6 Comment(13)
Thanks, good point, I also think a good speration is important for future maintenance.Breland
Especially if you have a few junior/ undisciplined programmers in your team :)Sextans
I've never seen any code in a Tapestry 5 template. How should that work?Adao
I see. Well, it's not exactly code, as you must still use components, and a loop is just one of them. But you're right, I also prefer the instrumentation syntax, and maybe the <t:... syntax should have been left out.Adao
Good work, Sergey! Thanks for that. I was always too lazy to check out Wicket in depth. +1Adao
@Henning, Now I understand the advice to study project mailing list carefully before choosing a framework. I would study Tapestry 5 in the first place if I would follow that.Sextans
Don't assume Tapestry is actually more efficient on all accounts. Previous benchmarks showed a very comparable performance. I have personally always doubted Tapestry (4 and below, don't know about 5) object pooling, which in practice may turn out to be more expensive than just creating the objects. Also, state has to go somewhere; just keeping it in memory is vastly more efficient than e.g. externalizing it.Roath
@chillenious, in Tapestry 5 component pooling is essential because T5 component creation is expansive operation. From the other side it makes possible to do elaborate optimizations. For example converting recursive component tree to optimized state machine. That makes difference if you have a lot of components. See tapestryjava.blogspot.com/2009/02/speeding-up-tapestry-51.htmlSextans
@chillenious, at least with Tapestry 5 you have a choice either to use memory extensively or not. As I understand with Wicket you can only play with where to store user sessions.Sextans
Sergey, to prove my point: see ptrthomas.wordpress.com/2009/09/14/… Even if you discard that is a biased microbenchmark (which I think it isn't), just don't assume, measure. The results there (that Wicket is faster and consumes less memory), is consistent with various benchmarks I ran myself and heard of other people running over the years. I wouldn't say the difference is large enough to pick your framework on though; just pick the one that fits your style best.Roath
> at least with Tapestry 5 you have a choice either to use memory extensively or not. As I understand with Wicket you can only play with where to store user sessions. You can choose where to store just about anything. It's a very flexible framework, especially because it leaves developers in charge of object creation etc. We just don't support client state saving, mainly because when we were half way implementing it, it turned out to be so inefficient (as it is in ASP.NET, JSF, etc) that we didn't think it was worth our effort.Roath
@chillenius, I think the most interesting part in the latter comparison is in the comments. See the 39rd comment by Igor Drobiazko. IMHO the author approach to rewrite the base application very close to the original is not good to measure performance. It's like writing C style programs in Lisp to prove that Lisp is much slower.Sextans
@chillenius, I agree that the current T5 docs are not very fine.Sextans
U
10

Here's a pretty thorough comparison from IBM's Developer Works.

http://www.ibm.com/developerworks/java/library/os-tapestrywicket/index.html?ca=drs

Update: link is dead, but you can find the page on http://web.archive.org/web/20131011174338/http://www.ibm.com/developerworks/java/library/os-tapestrywicket/index.html?ca=drs

Unbearable answered 6/8, 2009 at 16:43 Comment(3)
would love to see a comparison like that using tapestry 5Clercq
Sorry, that article only covers Tapestry 4, so it really isn't relevant anymore.Carlacarlee
@jzd web.archive.org/web/20131011174338/http://www.ibm.com/…Rhonarhonchus
F
1

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...).

Fully answered 18/7, 2009 at 7:0 Comment(0)
O
0

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.

Ornithine answered 23/3, 2009 at 7:5 Comment(1)
It has also good integration with Guice (once you get it working, the setup may be a bit cumbersome sometimes).Lithea
V
0

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

Vinitavinn answered 16/1, 2010 at 10:47 Comment(4)
A lot of frameworks claim that, none of them have actually proved to be right yet. Certainly Wicket has done some stuff in absurdingly cumbersome way, but just by copying the best of Wicket does not a better framework make. Also their quick start is more complex than Wicket on step 1 already.Boob
After Click quick start you can use Click (write code). After Wicket quick start you have wicket installed - feel a difference? ;-) Click isn't second copy of Wicket. They born near the same time, inspired by Tapestry. 2Stephan: if you like Stripes, you will love CLick, as Stripes book author do: stripesbook.org/blog/index.php?/archives/…Vinitavinn
Wicket QuickStart is a Maven POM creator, Click's QuickStart is equivalent to Wicket's "Hello World" @ wicket.apache.org/examplehelloworld.html Also seems like Click doesn't really have separation of code and markup which is one of the biggest features of Wicket - in fact Click uses Velocity for the HTML which is a templating language in itself. Because of this Click isn't really component oriented even though it claims to be, it's more close to JSTL or maybe Tapestry in that regard. Also you're clearly advertising which makes me feel uneasy about your post as a whole.Boob
1) For me (and for example for this guy assertinteresting.com/2009/03/why-i-prefer-stripes-over-wicket) quick start mean a bit more (quote: if you read the quick start guide, a mere 3 pages or so, you’ll basically “get” Stripes). 2) I'm not so purist, after long time with "raw" servlets+JSP, then servlets+Freemarker, then SpringMVC+Freemarker Click is enough OO and component oriented to me. 3) I like Spring and Freemarker. Click has same "fun" as them both. 4) I'm not affiliated with the Click framework, I'm just a huge fan.Vinitavinn
M
0

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/

Manhattan answered 16/1, 2010 at 11:0 Comment(1)
Also see #1303938Cognizable
C
0

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.

Cognizable answered 13/6, 2010 at 9:48 Comment(2)
This seems like FUD to me; there's thousands of happy Tapestry 5 users, and only a handful of committers. We've gone to great lengths to keep upgrades in Tapestry 5 as painless as possible.Gamber
There is a difference between painful experience and FUD.Cognizable

© 2022 - 2024 — McMap. All rights reserved.