velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Revusky <revu...@wanadoo.es>
Subject Re: The Guardian website moves to Velocity
Date Fri, 11 May 2007 16:26:15 GMT
Robert Koberg wrote:
> On Fri, 2007-05-11 at 16:43 +0200, Daniel Dekany wrote: 
> 
>>Friday, May 11, 2007, 2:51:36 PM, Townson, Chris wrote:
> 
> 
>>>2. (And this is the main reason) Because Velocity explicitly does
>>>not attempt to be a solution which bundles everything and the
>>>kitchen sink. The clear delineation of responsibility (basically,
>>>taking a context+template and rendering) combined with clear
>>>extension points and an elegant syntax made it ideal for our
>>>purposes.
>>
>>Based on what I understand from your system, you need a template
>>language only for some very trivial templating tasks, and then it
>>really doesn't mater which template engine you are using, so I won't
>>start debating if you have to face more complexity or less points of
>>extension with FreeMarker. Well, I think you wouldn't, but whatever.
> 
> 
> I do something similar to Chris. I use XSL to create the 'runtime'
> template page/code and currently can switch between velocity and JSP
> since it is so simple. 

THe templates generated may be simpler, but the overall architecture, a 
pipeline of XML->XSLT->VTL->final output is, it seems to me, quite 
complex. (Maybe it doesn't seem that way to you, but that would probably 
be because you're used to it...)

>Haven't tried FreeMarker.
> 
> 
>>However, I don't understand the "elegant syntax" part. I would think
>>that that:
>>
>>  #component("MyComponent", {"id":$myComponent.id})
>>
>>is rather less elegant than more elegant than:
>>
>>  <@component "MyComponent", id=myComponent.id />
> 
> 
> Are all/most of the FreeMarker examples in this kind of syntax rather
> than your relatively new XML syntax. 

At the moment, all the examples in the docs are in the older syntax. 
This may change in the next release. We're seriously considering making 
the newer syntax the default in the next release cycle.

Actually, in the 2.4 codebase, the parser autodetects by default what 
syntax you're using, so it's just the question of what we use in docs 
and examples. Also, we'll have a canonicalizer that can be run over 
older templates to convert them to the newer syntax.

> It would be hard for the interface
> type devs to see these in your docs and mentally switch to the XML
> syntax, I think. Since I use XSL/XML, it is difficult to transform out
> to a non well-formed result.

Well, the alternative syntax makes this point moot, but the other deeper 
point, I think, is that, once you're using FreeMarker, there isn't that 
much reason to use this pipeline of generating a template with XSLT. You 
could do everything with FreeMarker, since it is a very powerful XML 
transformation tool in its own right. See:

http://freemarker.sourceforge.net/docs/xgui_declarative_basics.html

Likely, you could replace your:

XML->XSLT->VTL->final output

to just:

XML->FTL->final output.

And that truly would be simpler, I'd say. Of course, I told you this 
before, and you weren't interested for whatever reason.

It's just that wrt the ostensible topic, the advantage of Velocity's 
"simplicity", it really seems to me that in your case, as a direct 
consequence of Velocity's "simplicity", i.e. that it's not a serious XML 
transformation tool, you end up with a much more complex architecture 
than you would otherwise. I wonder how general a phenomenon this is: the 
"simplicity" of a tool actually leads directly to greater architectural 
complexity. The mechanism is that the tool is not powerful enough for 
the job, so you need to bring in some other tool and chain the two 
things together, which actually results in a more complex system than 
you would otherwise have.

Jonathan Revusky
--
lead developer, FreeMarker project, http://freemarker.org/






> 
> best,
> -Rob


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message