velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: ArrayList Failure
Date Wed, 14 Feb 2001 12:52:47 GMT
Ivan Saltz wrote:
> 
> On Tue, 13 Feb 2001, you wrote:
> > > [snip]
> and --snip again --
> >
> > That's right.  While it seems strange to us programmers, the philosophy of
> > the Velocity Template Language (VTL) is 'Keep It Simple' because the
> > audience is intented to be designers.  That isn't a statement or judgement
> > about designers or their abilities, but VTL isn't supposed to be a
> > programming language, and we are doing a decent job of keeping it simple, as
> > much as it pains some of us :)
> 
> And I wouldn't argue against the philosophy. It is in fact, the very
> thing that made me want to try a project with Velocity. So strongly
> do I agree with this essential that, 1) I force empty vars into
> "&nbsp;" just so the designer wouldn't have to write
> #if ($var) $var #else &nbsp; #end
> This is required for Netscape browsers, and we (designer and I) felt
> that it was too much programming in the template. So my own rule is
> no null values in table displays.

Right - in tables.  Yes... 

> 
> and 2) I'm not sure that I can justify a macro. At least not yet :)

It has taken many people a bit of time to get used to it, but some of
the biggest critics are now the biggest supporters :)

The most compelling sales pitch so far is to think of them as a
convenient replacement for cut'n'paste : a Velocimacro (VM) doesn't
allow the designer to do anything more than what they can already do,
since the VM body is just VTL, anything that is repeated (like
formatting tables from a dataset, or a mini-form for shopping cart
submission, whatever...) is an ideal candidate for VMs.

Yes, they can get a little wacky (for example, see the JDOM tree walker
template example that uses a recursive VM to walk a JDOM tree in the
whiteboard/geir directory), but they are worth keeping in mind to keep
designers from having to do things that a programmer would be keelhauled
for doing.

If it would make you feel better, you can always use the global library
feature to set up predefined VMs for use, and then turn off the ability
to declare VMs in templates.   That way, it's similar to a
'parameterized #parse()' or something...

geir

--  
Geir Magnusson Jr.                               geirm@optonline.com
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity

Mime
View raw message