BTW, some of the JetBrains folks said that FreeMarker support will be in
8 and should be available in EAP soon! This will definitely help move me
farther away from JSPs. :)
-bp
Jeromy Evans wrote:
Jonathan Revusky wrote:
Thanks for the detailed argument Jonathon.
Jeromy Evans wrote:
Niall Pemberton wrote:
I just saw the following comment
"FreeMarker is very similar to Velocity, as both are template
languages that can be used outside of a Servlet container. The
framework utilizes FreeMarker because FreeMarker has better error
reporting. However, both are good alternatives to JSP."
I've questioned that a few times myself. The paragraph doesn't do
FreeMarker much justice from a technical sense, but then again, most
Struts 2 users won't exploit the features FreeMarker offers above
Velocity,
What is your basis for thinking this? It's clear enough from the
freemarker-user list that people do use advanced features of the tool
that are not in Velocity. I just don't see offhand why the usage
patterns of people using FreeMarker in conjunction with Struts 2
would be particularly different from users in general.
Though, the other thing is that, even if the assertion were true, I
don't know how you would know it was... it seems like a seat of the
pants conjecture...
The basis of my conjecture is that Struts 2 provides little support
for FreeMarker's more advanced features, so most users won't exploit
those features.
The model provided to FreeMarker is a map containing the request,
response, ValueStack and a few other basic structures, where access to
the ValueStack (Struts2's core model) is limited to Struts2 tags to in
order to access OGNL. I don't know the history, but it appears the
FreeMarkerResult[1] was designed to be equivalent to the Velocity
implementation rather than to exploit FreeMarker features. Similarly,
although the Struts 2 tags use FreeMarker templates, the model is
limited and the templates don't encourage what I think you'd consider
to be best-practice.
My conjecture still stands, that "as built", most Struts 2 users won't
exploit FreeMaker's better features. That's not meant as a criticism
of FreeMarker.
Take a quick look at the source:
[1]
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/
[2]
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/css_xhtml/
....
FreeMarker is technically superior in (almost?) every way, but not
always appropriate.
I have heard this before, but I cannot conceive of a usage scenario in
which Velocity would be indicated over FreeMarker. In terms of JSP,
that has the obvious advantages associated with being a standard,
greater tool support, more people out there who already know it. That
said, there are plenty of people who prefer FreeMarker. The reasons
vary, but I think they just find that it's a a lot cleaner...
conceptually, I guess. As for things like JRuby or Groovy results, I
think that is something so different that a direct comparison with
FreeMarker or Velocity doesn't make much sense.
I agree with most of your statements but there are many cases where
technically superiority does not mean it is the most appropriate
solution. Perhaps you have the good fortune of only working with
experienced java developers and don't have to trade-off development
costs, but the learning curve, familiarly with the syntax and tools
support are issues that do exist and are impediments to the take-up
and cost-of-development with FreeMarker.
We should link to/provide something that helps users decide what
best suits their circumstances,
Anything you link to would be just somebody else's opinion. There is no
reason that you could not offer your own opinion. I'd infer that you
don't want to point out there that a fellow ASF project is abjectly
inferior, so, okay, you provide a link where some 3rd party says it,
but you know.... ;-)
I'm not sure if biases exist like that; the PMC would have to comment.
I've never noticed anything like that, especially with Struts2's heavy
dependency an opensymphony projects and the project's core dependency
on FreeMarker. I'm expressing a personal opinion, which was that
FreeMarker is technically superior but not always appropriate. I
personally would rarely choose Velocity, but I also can't recommend
FreeMarker with a broad-stroke.
including the argument for and against JSP. I don't think there
will ever consensus to recommend one.
I think that in terms of FreeMarker vs. Velocity, there is a pretty
strong consensus among technically informed people in favor of
FreeMarker. As for JSP or other things, like XSLT maybe, or Groovy or
JRuby, they aren't directly comparable in the same way that
FreeMarker and Velocity are.
They're comparable within the context of Struts 2 at alternative
approaches to implement the action or result. My point was to
encourage Struts 2 users to consider the most appropriate solution
instead of focusing on a particular technology.
At the same time it may be useful to compare these to why a
JRuby-based or Grails-based action/result may be more suitable.
Blog anyone?
Well, again, you're bringing in things that aren't directly
comparable in the way that FreeMarker and Velocity are. And that was
the topic at hand. Limited to those two things, the case for
FreeMarker is just
devastating, I think. It is not an objective source obviously, but I
think the following covers the points:
http://freemarker.blogspot.com/2007/12/velocity-of-freemarker-looking-at-5.html
And it's not unfair to link it, I suppose, because if the Velocity
people cared to write a rebuttal, they have the right to, and you
could link that as well. That blog article contains links to some
other blog articles detailing a switch from Velocity to FreeMarker.
http://in.relation.to/Bloggers/AStoryAboutFreeMarkerAndVelocity
http://blog.nominet.org.uk/tech/2005/06/29/moving-from-velocity-to-freemarker
http://blogs.sun.com/satya/entry/migrate_to_freemarker_from_velocity
Of course, you could say that the above ones are cherry picked to
support the case for FreeMarker. But actually, go look for similar
blog articles about a move in the opposite direction. You'll come up
empty handed, I dare say.
Oh, and as for FreeMarker vs. JSP, Jive Software, whose flagship
product is built on Webwork 2 and FreeMarker, switched from JSP to
FreeMarker. Here is some discussion by the Jive developers on that.
http://article.gmane.org/gmane.comp.web.freemarker.user/2984
http://www.jivesoftware.com/community/blogs/clearspace/2007/07/20/the-switch-to-freemarker
Note the last point Bruce made there on our mailing list: "It's
powerful enough for our needs -- velocity didn't have the features we
required." This does seem to contradict the idea that Struts 2 users
would not need the extra power that FreeMarker offers. Just one data
point admittedly, but it tells you something.
Well, 'nuff said, I guess. In some private conversation, one of my
collaborators on FreeMarker pointed to the quote above on your site
about FreeMarker vs. Velocity and, you know, basically said that it
was highly annoying... there's a strong sense out there (right or
wrong) that something like this is an example of you bending over
backwards to be charitable to a fellow ASF project. I had seen that
page before and that was my impression as well. I dunno... Do what
you want, but I don't think you're doing anybody any favors by
holding back on telling the unvarnished truth about this kind of
thing. I don't think that it's even a favor to the Velocity
community, though, you know, if some of the blogs I have linked never
shook them out of their complacency, I don't know what would... :-)
Jonathon, you're preaching to the converted. I think most Java
developers that have used FreeMarker prefer it to the alternatives for
the reasons you've mentioned. The technical argument was won long
ago. The next battle is that of wide-spread IDE support and easing
the learning curve for the JSP-focused kids still coming out of uni.
Struts 2 has to face similar battles as other frameworks exist that
are cheaper to use or provide better features in any aspect examined
in isolation. I understand your sensitivity to FreeMarker vs Velocity
debates but in this case all posts were pro-FreeMarker and all caveats
were on non-technical basis.
I'll make sure the dismissive comparison of FreeMarker vs Velocity is
updated as per my original post, including your links to the
"unvarnished truth".. Also if you have suggestions for Struts 2 to
better utilize FreeMarker it would be helpful to continue to provide
feedback as I'm certain it's not utilized well.
cheers,
Jeromy Evans
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]