You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Daniel Fagerstrom <da...@nada.kth.se> on 2004/12/04 19:31:43 UTC

Re: [RT] Attribute Driven Templates

Jonas Ekstedt wrote:
> On Sat, 4 Dec 2004, Daniel Fagerstrom wrote:
> 
> snip...
> 
>>if(<test>)
>>----------
>>
>>example:
>>
>><div do="if(count(cart/item) == 0)">
>>   Your cart is empty
>><div>
>>
> 
> How would you implement choose/when?

I woudn't, don't think it works that well with Dreamweaver and such 
things. You can use a number of if instead. I would also assume that 
there is an upper bound on complexity when "fill in the blanks"-style 
templating isn't feasible anymore and when it becomes more or less 
meaningsless to try to edit it in dreamweaver. In such cases rule based 
templates are better.

Anyway, my Dreamweaver experience is quite limited, I used it for 
implementing a site design from Illustrator to HTML and CSS. It was fun 
for a short while. But I'm not the right kind of person for using 
dreamweaver. I'm fanatic in avoiding any style elements in HTML so I do 
everything in CSS and DWs CSS support didn't impress me. So after a 
while I went back to emacs again :)

Hopefully people that have succeded in using DW to their advantage will 
tell whats needed and usefull.


> snip...
> 
>>Several directives
>>------------------
>>
>>So, how do we handle multiple directives for one element? We could
>>handle the TAL example above like:
>>
>><p
>>do="let(x=/a/long/path/from/the/root;if(x);content(x/txt);attributes(class=x/class)">
>>   Ex Text
>></p>
> 
> 
> Isn't there a risk that attribute templates become unreadable?

As said above, I don't think they are intended for complicated designs. 
I would use XSLT in such cases. My example above was chosen more for 
desscribing the mechanism than for being realistic.

Furthermore I forgot a paranthese in a place that was quite bad from a 
pedagogical POV. It should have been:

<p 
do="let(x=/a/long/path/from/the/root);if(x);content(x/txt);attributes(class=x/class)">
   Ex Text
</p>

I find it actually quite readable, but thats probably because I designed 
it ;) and also have spend a lot of time with functional programming 
languages (e.g. that in Mathematica). You can think of ';' as functional 
composition.

> snip...
> 
>>Connection to JXTG
>>------------------
>>
>>The directives are almoust defined in such a way that they could be
>>translated to a tag based templating language like:
>>
>>directive(param_1=value_1,...,param_n=value_n)
>>
>><=>
>>
>><jx:directive param_1="value_1" ... param_n="value_n"/>
>>
>>Maybe we could find a attribute directive language that allows for
>>complete correspondance. And make tag or directive syntax selectible and
>>in such way make this effort compatble with JXTG?
> 
> I like this idea very much. It would be a shame if the quirks of
> Dreamweaver should force everyone to use an awkward syntax.

The attribute driven synatax is new to me so I don't know if I find it 
awkward or not, I'll need to see some larger examples. Anyway, we have a 
user community (and our own webbaps) to think about, we cannot change 
dirrection at every whim. We must support JXTG for the forseable future 
so I would prefer if we could allow both syntaxes.

Now, it will be interesting to see how long time it will take before 
someone explains that: this is FS we only need to support one syntax, 
namely the obviously optimal one, and those who believe that they need 
the other one are generally less knowing and doesn't understand their 
own best ;)

/Daniel

Re: [RT] Attribute Driven Templates

Posted by Reinhard Poetz <re...@apache.org>.
Leszek Gawron wrote:
> Reinhard Poetz wrote:
> 
>> Leszek Gawron wrote:
>>
>>> Reinhard Poetz wrote:
>>>
>>>> But the Dreamweaver usecase is a valid one (It was me who started a 
>>>> discussion about this in May after attenting a Tapestry seminar at a 
>>>> conference) and so we should support it.
>>>>
>>>>>
>>>>> Now, having them cohexist in the page smells like FS, though ;-)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Can't agree more.
>>>
>>>
>>>
>>> What would you do then if you started simple (with attributes) and 
>>> found out after a while (when the template is already quite big) that 
>>> you need a tag syntax in some places?
>>>
>>
>> Aren't they completly equivalent?
> 
> Yes they are (will/would be). Thing is you do not want them to coexist 
> in a single template.

Without a usecase where it makes really sense to support both ways, no.
(Think of the complaints about the two syntax for expression languages.)

-- 
Reinhard

Re: [RT] Attribute Driven Templates

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Reinhard Poetz wrote:
> Leszek Gawron wrote:
> 
>> Reinhard Poetz wrote:
>>
>>> But the Dreamweaver usecase is a valid one (It was me who started a 
>>> discussion about this in May after attenting a Tapestry seminar at a 
>>> conference) and so we should support it.
>>>
>>>>
>>>> Now, having them cohexist in the page smells like FS, though ;-)
>>>
>>>
>>>
>>>
>>> Can't agree more.
>>
>>
>> What would you do then if you started simple (with attributes) and 
>> found out after a while (when the template is already quite big) that 
>> you need a tag syntax in some places?
>>
> 
> Aren't they completly equivalent?
Yes they are (will/would be). Thing is you do not want them to coexist 
in a single template.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Re: [RT] Attribute Driven Templates

Posted by Reinhard Poetz <re...@apache.org>.
Leszek Gawron wrote:
> Reinhard Poetz wrote:
> 
>> But the Dreamweaver usecase is a valid one (It was me who started a 
>> discussion about this in May after attenting a Tapestry seminar at a 
>> conference) and so we should support it.
>>
>>>
>>> Now, having them cohexist in the page smells like FS, though ;-)
>>
>>
>>
>> Can't agree more.
> 
> What would you do then if you started simple (with attributes) and found 
> out after a while (when the template is already quite big) that you need 
> a tag syntax in some places?
> 

Aren't they completly equivalent?

-- 
Reinhard

Re: [RT] Attribute Driven Templates

Posted by Stefano Mazzocchi <st...@apache.org>.
Leszek Gawron wrote:
> Reinhard Poetz wrote:
> 
>> But the Dreamweaver usecase is a valid one (It was me who started a 
>> discussion about this in May after attenting a Tapestry seminar at a 
>> conference) and so we should support it.
>>
>>>
>>> Now, having them cohexist in the page smells like FS, though ;-)
>>
>>
>>
>> Can't agree more.
> 
> What would you do then if you started simple (with attributes) and found 
> out after a while (when the template is already quite big) that you need 
> a tag syntax in some places?

You come back here and ask for that feature.

Clean design rule #1: avoid YAGNI.

-- 
Stefano.


Re: [RT] Attribute Driven Templates

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Reinhard Poetz wrote:
> But the Dreamweaver usecase is a valid one (It was me who started a 
> discussion about this in May after attenting a Tapestry seminar at a 
> conference) and so we should support it.
> 
>>
>> Now, having them cohexist in the page smells like FS, though ;-)
> 
> 
> Can't agree more.
What would you do then if you started simple (with attributes) and found 
out after a while (when the template is already quite big) that you need 
a tag syntax in some places?

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Re: [RT] Attribute Driven Templates

Posted by Reinhard Poetz <re...@apache.org>.
Stefano Mazzocchi wrote:
> Daniel Fagerstrom wrote:
> 
>>> I like this idea very much. It would be a shame if the quirks of
>>> Dreamweaver should force everyone to use an awkward syntax.
>>
>>
>> The attribute driven synatax is new to me so I don't know if I find it 
>> awkward or not, I'll need to see some larger examples. Anyway, we have 
>> a user community (and our own webbaps) to think about, we cannot 
>> change dirrection at every whim. We must support JXTG for the 
>> forseable future so I would prefer if we could allow both syntaxes.
>>
>> Now, it will be interesting to see how long time it will take before 
>> someone explains that: this is FS we only need to support one syntax, 
>> namely the obviously optimal one, and those who believe that they need 
>> the other one are generally less knowing and doesn't understand their 
>> own best ;)
> 
> 
> I know you are looking at me :-) but interestingly enough, my FS alarm 
> didn't go off.
> 
> I really think that it makes sense to have two different syntaxes, one 
> that uses elements and another one that uses attributes.

Yes, I think we need both ways. *I* prefer the element style because for me 
expresions like

<p 
do="let(x=/a/long/path/from/the/root;if(x);content(x/txt);attributes(class=x/class)">
   Ex Text
</p>

are close to be unreadable - I have the feeling of looking at a regular 
expression (and this is _not_ a good feeling)

But the Dreamweaver usecase is a valid one (It was me who started a discussion 
about this in May after attenting a Tapestry seminar at a conference) and so we 
should support it.

> 
> Now, having them cohexist in the page smells like FS, though ;-)

Can't agree more.

-- 
Reinhard

Re: [RT] Attribute Driven Templates

Posted by Glen Ezkovich <gl...@hard-bop.com>.
On Dec 5, 2004, at 11:59 AM, Stefano Mazzocchi wrote:

> Glen Ezkovich wrote:
>> On Dec 5, 2004, at 10:02 AM, Daniel Fagerstrom wrote:
>>> Your alarm might have been desensitized by our continuos stream of 
>>> FS ;) Actually it would be boring if you were easy to predict.
>>>
>>>> I really think that it makes sense to have two different syntaxes, 
>>>> one that uses elements and another one that uses attributes.
>>>
>>>
>>> So do I.
>>>
>>>> Now, having them cohexist in the page smells like FS, though ;-)
>> Yes, thats why they should be in separate components. Pick your 
>> poison. You know over time that one language will evolve past the 
>> other. Having to maintain equivalence is a burden not needed. As I've 
>> stated before picking the language should be a compile time decision.
>
> -1, that would make it impossible to use the two syntaxes in different 
> parts of the site and there is no need to restrict that since it's 
> perfectly valid that some parts of the templates will be edited by 
> some people and some others by some others, with different skills.

Why? Just to be clear, I meant Java compile time. Use different 
generators and transformers for each language. If you generate using 
one, there is no reason to have to stick to the same language in the 
transformation. Same goes for multiple transformations. I don't see the 
need to use the same language in every step of a pipeline. The idea is 
to provide as much flexibility as possible while constraining the use 
of multiple languages in a single template.


Glen Ezkovich
HardBop Consulting
glen at hard-bop.com
http://www.hard-bop.com



A Proverb for Paranoids:
"If they can get you asking the wrong questions, they don't have to 
worry about answers."
- Thomas Pynchon Gravity's Rainbow


Re: [RT] Attribute Driven Templates

Posted by Stefano Mazzocchi <st...@apache.org>.
Glen Ezkovich wrote:
> 
> On Dec 5, 2004, at 10:02 AM, Daniel Fagerstrom wrote:
> 
>> Your alarm might have been desensitized by our continuos stream of FS 
>> ;) Actually it would be boring if you were easy to predict.
>>
>>> I really think that it makes sense to have two different syntaxes, 
>>> one that uses elements and another one that uses attributes.
>>
>>
>> So do I.
>>
>>> Now, having them cohexist in the page smells like FS, though ;-)
> 
> 
> Yes, thats why they should be in separate components. Pick your poison. 
> You know over time that one language will evolve past the other. Having 
> to maintain equivalence is a burden not needed. As I've stated before 
> picking the language should be a compile time decision.

-1, that would make it impossible to use the two syntaxes in different 
parts of the site and there is no need to restrict that since it's 
perfectly valid that some parts of the templates will be edited by some 
people and some others by some others, with different skills.

-- 
Stefano.


Re: [RT] Attribute Driven Templates

Posted by Glen Ezkovich <ge...@mac.com>.
On Dec 5, 2004, at 10:02 AM, Daniel Fagerstrom wrote:

> Your alarm might have been desensitized by our continuos stream of FS 
> ;) Actually it would be boring if you were easy to predict.
>
>> I really think that it makes sense to have two different syntaxes, 
>> one that uses elements and another one that uses attributes.
>
> So do I.
>
>> Now, having them cohexist in the page smells like FS, though ;-)

Yes, thats why they should be in separate components. Pick your poison. 
You know over time that one language will evolve past the other. Having 
to maintain equivalence is a burden not needed. As I've stated before 
picking the language should be a compile time decision.


Glen Ezkovich
HardBop Consulting
glen at hard-bop.com
http://www.hard-bop.com



A Proverb for Paranoids:
"If they can get you asking the wrong questions, they don't have to 
worry about answers."
- Thomas Pynchon Gravity's Rainbow


Re: [RT] Attribute Driven Templates

Posted by Stefano Mazzocchi <st...@apache.org>.
Daniel Fagerstrom wrote:
> Stefano Mazzocchi wrote:
> 
>> Daniel Fagerstrom wrote:
>>
>>>> I like this idea very much. It would be a shame if the quirks of
>>>> Dreamweaver should force everyone to use an awkward syntax.
>>>
>>>
>>> The attribute driven synatax is new to me so I don't know if I find 
>>> it awkward or not, I'll need to see some larger examples. Anyway, we 
>>> have a user community (and our own webbaps) to think about, we cannot 
>>> change dirrection at every whim. We must support JXTG for the 
>>> forseable future so I would prefer if we could allow both syntaxes.
>>>
>>> Now, it will be interesting to see how long time it will take before 
>>> someone explains that: this is FS we only need to support one syntax, 
>>> namely the obviously optimal one, and those who believe that they 
>>> need the other one are generally less knowing and doesn't understand 
>>> their own best ;)
>>
>>
>> I know you are looking at me :-) but interestingly enough, my FS alarm 
>> didn't go off.
> 
> Your alarm might have been desensitized by our continuos stream of FS ;) 

no, well, FS is triggered when a solution is proposed for a problem that 
has not been mentioned but it makes sense from a "completeness" point of 
view. Here, things are different since all sort of problems and 
requirements were put on the table and in order to make everybody happy 
the compromise has to be rather flexible.

The problem I have is never how flexible (otherwise, cocoon wouldn't be 
here, right?) is "how more flexible than needed".

> Actually it would be boring if you were easy to predict.

Not only that, I would be useless. My only contributions to this project 
are basically to scream "FS!!!" once and a while :-)

>> I really think that it makes sense to have two different syntaxes, one 
>> that uses elements and another one that uses attributes.
> 
> So do I.
> 
>> Now, having them cohexist in the page smells like FS, though ;-)
> 
> How did you know that I was going to propose that? 

ehm, I can spot people that design by constrain vs. those that design by 
symmetry. The second are the one I watch more closely because those are 
the one more likely to incurr in FS.

> And teling about my 
> idea about how to make the choice of tag language compiler and 
> implementation language triggered on each template tag is no idea any 
> more, I guess ;)

I should make T-shirts with YAGNI written on the front and on the back 
for some of you people ;-)

-- 
Stefano.


Re: [RT] Attribute Driven Templates

Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Stefano Mazzocchi wrote:
> Daniel Fagerstrom wrote:
> 
>>> I like this idea very much. It would be a shame if the quirks of
>>> Dreamweaver should force everyone to use an awkward syntax.
>>
>> The attribute driven synatax is new to me so I don't know if I find it 
>> awkward or not, I'll need to see some larger examples. Anyway, we have 
>> a user community (and our own webbaps) to think about, we cannot 
>> change dirrection at every whim. We must support JXTG for the 
>> forseable future so I would prefer if we could allow both syntaxes.
>>
>> Now, it will be interesting to see how long time it will take before 
>> someone explains that: this is FS we only need to support one syntax, 
>> namely the obviously optimal one, and those who believe that they need 
>> the other one are generally less knowing and doesn't understand their 
>> own best ;)
> 
> I know you are looking at me :-) but interestingly enough, my FS alarm 
> didn't go off.

Your alarm might have been desensitized by our continuos stream of FS ;) 
Actually it would be boring if you were easy to predict.

> I really think that it makes sense to have two different syntaxes, one 
> that uses elements and another one that uses attributes.

So do I.

> Now, having them cohexist in the page smells like FS, though ;-)

How did you know that I was going to propose that? And teling about my 
idea about how to make the choice of tag language compiler and 
implementation language triggered on each template tag is no idea any 
more, I guess ;)

/Daniel

Re: [RT] Attribute Driven Templates

Posted by Stefano Mazzocchi <st...@apache.org>.
Daniel Fagerstrom wrote:

>> I like this idea very much. It would be a shame if the quirks of
>> Dreamweaver should force everyone to use an awkward syntax.
> 
> The attribute driven synatax is new to me so I don't know if I find it 
> awkward or not, I'll need to see some larger examples. Anyway, we have a 
> user community (and our own webbaps) to think about, we cannot change 
> dirrection at every whim. We must support JXTG for the forseable future 
> so I would prefer if we could allow both syntaxes.
> 
> Now, it will be interesting to see how long time it will take before 
> someone explains that: this is FS we only need to support one syntax, 
> namely the obviously optimal one, and those who believe that they need 
> the other one are generally less knowing and doesn't understand their 
> own best ;)

I know you are looking at me :-) but interestingly enough, my FS alarm 
didn't go off.

I really think that it makes sense to have two different syntaxes, one 
that uses elements and another one that uses attributes.

Now, having them cohexist in the page smells like FS, though ;-)

-- 
Stefano.