velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Dekany <ddek...@freemail.hu>
Subject Re: The Guardian website moves to Velocity
Date Fri, 11 May 2007 17:43:29 GMT
Friday, May 11, 2007, 5:28:48 PM, Townson, Chris wrote:

>> 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.
>> 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 />
>> 
>
> Sure, as I mentioned, the template "client" could, I'm sure, be
> just as easily implemented in FreeMarker. The requirements on that side are simple.
>
> As for syntax, welllll - I would never let mere syntax be the
> ultimate determinant vis-a-vis a choice between VTL and FM. However,
> I have to say, I personally prefer VTL syntax and find FreeMarker
> very ugly - but, before that starts any arguments, I must emphasize
> that this is merely a preference ...

I prefer the WebMaco-style syntaxes over HTML/XML-style ones as
well... (for this kind of template languages like Velocty or
FreeMarker at least), but haven't seen any realization of that flavor
that I could find worthwhile... /-: Too bad, and my turn to solve
this, I guess. Anyway, what I wanted to point out is that more
"features" can mean that you can express yourself more elegantly,
which is in no way mean less understandable, but rather the opposite
(see the id thing earlier).

> however, I do have doctorate in art history and philosophical
> aesthetics, so I feel qualified to speak on the matter of beauty! ;D

<kidding>I wonder how they judge if you have a good enough taste to be
a doctor... also if I can possibly have more sense of aesthetics than
you have without having degree about it.</kidding>

>> Not to mention (that I'm not sure is possible with your system, as I'm
>> not sure what the first parameter means):
>> 
>
> The first parameter is a component id. In our current prototype
> implementation using Spring, this refers to the Spring bean id which
> is passed by the Velocity client to the "component loader service"
> to obtain an instance of the component.

I see. That can be written as:

  <@components.MyComponent id=myComponent.id />

At least if you can heal yourself of being sick because of <@ and />,
I think it's hard to say that it is less elegant than:

  #component("MyComponent", {"id":$myComponent.id})

(The "clear extension points" argument of yours comes into my mind
here... for the FM solution you have just drop that "components"
object into the template context (which can even be made globally, on
configuration/initalization time), no need to "customize" anything
either. Anyway... I don't want to be accused for FreeMarker
propaganda, so it was enough.)
  
> The second parameter (theoretically optional but nearly always
> required in practice) is a map containing initialization parameters.
> Typically, this would be something like a datasource ID (e.g. for
> the component to obtain other data from a Db during initialization).
>
>>   <@MyComponent id=myComponent.id />
>> 
>> where the "MyComponent" is a variable in the context.
>> 
>> And
>> 
>>   <h1>${this.heading}</h1>
>> 
>> is exactly the same with FreeMarker as well. So...
>> 
>
> sure - as I say, it could be done equally in FM, I'm sure.

(And then maybe it wouldn't take much time to create a custom solution
either... often it turns out to be smoother and more elegant than
trying to use an already existing solution. Well, whatever...)

-- 
Best regards,
 Daniel Dekany


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


Mime
View raw message