tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard Lewis Ship" <hls...@gmail.com>
Subject Re: [T5] If component / else
Date Sun, 14 Jan 2007 23:39:23 GMT
On 1/14/07, Jesse Kuhnert <jkuhnert@gmail.com> wrote:
> Since this looks like it's contained to logic in one or two components
> it's probably a debate that could be had at a later time, but just in
> case it doesn't come up again soon before T5 starts gaining more
> traction I'll throw in a more complete set of thoughts..
>
> -) Generally speaking, if / else if / else would of course be very
> good things to support.

Agreed.  Very often, when you have an If you have an alternate version
... it's usually about a choice between two options, rather than one
appearing or not.  There may also be room for something akin to a
switch/case construct, but we'll handle that later.

>
> -) This looks comparable to the argument for allowing components to
> specify default bindings for the sake of more intuitive / easy to
> write/remember template syntax. If we can agree that from a "template
> developer" point of view (someone who may or may not know how
> components work underneath the covers) this is clearer / easier to
> understand:
>
> <t:comp type="If" test="loggedIn">
> Welcome to the show, ${userName}!
> </t:comp><t:comp type="Else" >
>  Click <a t:type="ActionLink" t:id="login">here</a> to log in.
> </t:comp>

This is how its done in Tapestry 4. I have issues with this.  First,
its not possible to bind the Else except to the most recently rendered
If.  In Java, you have grouping constructs ("{" and "}") to make sure
your desires are unambiguous.

Although this is quite doable ... it's a matter of storing somewhere
the status of the most recent If evaluation so that the Else component
can read it.  that's not difficult, it would be an Environmental
service, its still just feels wrong to me.

>
> then the basic argument is at least agreed upon ? (the rest assumes
> that this statement is true)
>
> -) If I had to choose between making something harder for a component
> developer vs template writer (two fictitious people, don't want to
> sound like the ejb spec stating "deployer/developer/etc" roles ;) )
> I'd go with making it harder for the component developer.
>
> -) If no other argument works, then thinking about how easy the
> proposed logic will be for the mass conversion of velocity / jsp users
> we are expecting/hoping for should have some weight in the argument.
> (though of course this shouldn't normally be the case I guess ..)
> These systems support a similar syntax to that of the current <= T4 if
> / else components.
>
> Besides maybe the Table component I think the current T4 If/Else/For
> components are probably some of the more complicated "under the hood"
> components Tapestry has, but they also do a good job being fairly
> intuitive most of the time.

It's quite a bit simpler now; If doesn't have to have any interaction
with the Form the way it did in the past. The new approach to Form
handling, based on a serialized sequence of commands rather than
re-rendering, means that if the If doesn't render with the Form, then
components within the If simply don't exist when the Form is
submitted.  We have a very strong linkage between how the Form
renders, and what components are activated (and in what order) when
the HTML form visible to the user is submitted.

>
> just my 2 cents, don't want to distract you from the bigger picture /
> larger goals ..

This discussion is the essense of the Apache Way. I appreciate the
trust and lattitude that the community has given me, but there are a
few critical areas where developer and community input is essential.
I'm very aware that in some cases I may not be able to see the forrest
for the trees.  But hopefully, not too often.

>
> On 1/14/07, Howard Lewis Ship <hlship@gmail.com> wrote:
> > There's been a proposal to add a "then" parameter as well, thus:
> >
> > <t:comp type='If" test="loggedIn">
> > <t:parameter name="then">
> >  Welcome to the show, ${userName}!
> > </t:parameter>
> >  <t:parameter name="else">
> >    Click <a t:type="ActionLink" t:id="login">here</a> to log in.
> >  </t:parameter>
> > </t:comp>
> >
> <snipped>
> >
> >
> > --
> > Howard M. Lewis Ship
> > TWD Consulting, Inc.
> > Independent J2EE / Open-Source Java Consultant
> > Creator and PMC Chair, Apache Tapestry
> > Creator, Apache HiveMind
> >
> > Professional Tapestry training, mentoring, support
> > and project work.  http://howardlewisship.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: dev-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message