You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Pierce T. Wetter III" <pi...@paceap.com> on 2010/04/05 23:07:46 UTC

Why no recursive components?

   Just out of curiosity, why no recursive components? I re-implemented my navigation menu using a solution I found on Google, but it would have been a lot simpler if the menu items had been recursive instead having to use delegate stuff that felt very much like voodoo...

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


Re: Why no recursive components?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 05 Apr 2010 18:07:46 -0300, Pierce T. Wetter III  
<pi...@paceap.com> wrote:

>    Just out of curiosity, why no recursive components? I re-implemented  
> my navigation menu using a solution I found on Google, but it would have  
> been a lot simpler if the menu items had been recursive instead having  
> to use delegate stuff that felt very much like voodoo...

It's impossible to have a static structure when one instance of a  
component has another inside it. Infinite recursion.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da  
Informação Ltda.
http://www.arsmachina.com.br

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


Re: Why no recursive components?

Posted by "Pierce T. Wetter III" <pi...@paceap.com>.
>> This is a side-effect of Tapestry's static structure approach. A
>> component X embedded in the template of component Y is instantiated as
>> an object attached to object Y. This instantiation happens once, at
>> page load time.
>> 
>> For X to be recursive (to contain an X), we would need to instantiate
>> X and as part of that, instantiation another X to place inside the
>> first X.  To create the second X we need to instantiate a third X ...
>> you can see where this goes.
>> 
>> In theory, we could construct the component heirarchy for the page on
>> an as-needed basis, but that might cause its own problems (including
>> performance issues) and a while different set of lazy abstractions!

  Ah.... I get it. 

  So if I nest components A(B(C(D(E)))), and B(C(D(E)))

  Then tapestry builds the following components:

   A
   A.B
   A.B.C
   A.B.C.D
   A.B.C.D.E

   B
   B.C
   B.C.D
   B.C.D.E

   So while I've written only 5 components, I've instantiated 9, and A.B.C is a different component then B.C. Doing that lets you cache things more effectively. 

 
   Pierce


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


Re: Why no recursive components?

Posted by Howard Lewis Ship <hl...@gmail.com>.
I mean, leaky abstractions.

On Mon, Apr 5, 2010 at 2:18 PM, Howard Lewis Ship <hl...@gmail.com> wrote:
> This is a side-effect of Tapestry's static structure approach. A
> component X embedded in the template of component Y is instantiated as
> an object attached to object Y. This instantiation happens once, at
> page load time.
>
> For X to be recursive (to contain an X), we would need to instantiate
> X and as part of that, instantiation another X to place inside the
> first X.  To create the second X we need to instantiate a third X ...
> you can see where this goes.
>
> In theory, we could construct the component heirarchy for the page on
> an as-needed basis, but that might cause its own problems (including
> performance issues) and a while different set of lazy abstractions!
>
> On Mon, Apr 5, 2010 at 2:07 PM, Pierce T. Wetter III <pi...@paceap.com> wrote:
>>
>>   Just out of curiosity, why no recursive components? I re-implemented my navigation menu using a solution I found on Google, but it would have been a lot simpler if the menu items had been recursive instead having to use delegate stuff that felt very much like voodoo...
>>
>>  Pierce
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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


Re: Why no recursive components?

Posted by Howard Lewis Ship <hl...@gmail.com>.
This is a side-effect of Tapestry's static structure approach. A
component X embedded in the template of component Y is instantiated as
an object attached to object Y. This instantiation happens once, at
page load time.

For X to be recursive (to contain an X), we would need to instantiate
X and as part of that, instantiation another X to place inside the
first X.  To create the second X we need to instantiate a third X ...
you can see where this goes.

In theory, we could construct the component heirarchy for the page on
an as-needed basis, but that might cause its own problems (including
performance issues) and a while different set of lazy abstractions!

On Mon, Apr 5, 2010 at 2:07 PM, Pierce T. Wetter III <pi...@paceap.com> wrote:
>
>   Just out of curiosity, why no recursive components? I re-implemented my navigation menu using a solution I found on Google, but it would have been a lot simpler if the menu items had been recursive instead having to use delegate stuff that felt very much like voodoo...
>
>  Pierce
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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