You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mohammad Shamsi <m....@gmail.com> on 2007/12/26 12:09:00 UTC

why special position for pages, components and ...?

Hi,

i want to know that why i should place my pages and components in special
folder ?

any idea ?
-- 
sincerely yours
M. H. Shamsi

Re: why special position for pages, components and ...?

Posted by Angelo Turetta <at...@bestunion.it>.
Mohammad Shamsi wrote:
> but you can see some mechanism in JPA (Java Persistence API).
> here you just Annotate a class with @Entity for using it as a Entity in
> application.
> 
> i think number of entities in a application  is not much less then number of
> pages.but i have no  performance problem in my apps using JPA.

You are missing a central point: the T5 IOC layer generates 'artificial' 
classes at runtime, I mean raw JVM bytecode which extend from the 
page/component/service classes you write. That's where injected 
interfaces get their runtime values.
This process is quite cpu-intensive, so Tapestry chose to do it 
on-demand, and by default just for classes beneath a specific package. 
Doing it for all and any classes would mean that every class should be 
inspected by the IOC enhancer on its first use.
You can contribute additional package names for the ioc to 'enhance', 
but for a single application/library one package usually suffices.

If you have component/pages which are reused in more apps, or that you 
want to package by themselves for better code organization, extract the 
relevant pages/components source & templates and package them in a 
different maven/Eclipse project which will then be used as a dependency 
in your app.

Angelo.

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


Re: why special position for pages, components and ...?

Posted by Chris Lewis <ch...@bellsouth.net>.
> but you can see some mechanism in JPA (Java Persistence API).
> here you just Annotate a class with @Entity for using it as a Entity in
> application.
>   
I'm no JPA expert, but I use hibernate as my JPA/ORM implementation and 
I /still/ have to tell hibernate which classes are entities through a 
configuration (either xml or programmatically). You have to do this 
because there's no other way for the system to know where to find the 
classes - just like T5.
> i think number of entities in a application  is not much less then number of
> pages.but i have no  performance problem in my apps using JPA.
>   
I'm not comparing the number of pages to entities. I'm saying that if T5 
isn't told what java packages contain page classes, then it would not be 
able to load them unless it somehow scanned the entire collection of 
loaded classes in the JVM. Keep in mind that there are hundreds or 
thousands of loaded classes in the JVM, and then assuming you could do 
something like System.getLoadedClasses() .... you get the idea.
>
>
>
> On Dec 26, 2007 4:44 PM, Chris Lewis <ch...@bellsouth.net> wrote:
>
>   
>> Aside from the reason I just mentioned, T5 has to know where to look to
>> find pages (meaning a java package). With your suggested annotation only
>> half the work is done. If I'm not mistaken there is no clean way to
>> aggregate all loaded classed in the JVM. If there was, then T5 would
>> have to scan *all* of them for your annotation. I'd bet a good deal of
>> money that that would cause a performance hit ;-). Having a known set of
>> locations to look in solves the performance issue and answers the
>> generally unimportant question of where pages should live.
>>
>> Mohammad Shamsi wrote:
>>     
>>> i just know that Tapestry use this location for looking up pages.
>>> how about a simple Annotation for page classes instead of ?
>>> just with using a simple Annotation (for exmaple @Page) for a Page Class
>>> we code place classes every where that we like.
>>>
>>>
>>> On Dec 26, 2007 3:16 PM, Chris Lewis <ch...@bellsouth.net> wrote:
>>>
>>>
>>>       
>>>> Because it removes the necessity to think about something that
>>>>         
>> generally
>>     
>>>> doesn't deserve thought. If you want them elsewhere, make a
>>>>         
>> contribution
>>     
>>>> in your app module.
>>>>
>>>> chris
>>>>
>>>> Mohammad Shamsi wrote:
>>>>
>>>>         
>>>>> Hi,
>>>>>
>>>>> i want to know that why i should place my pages and components in
>>>>>
>>>>>           
>>>> special
>>>>
>>>>         
>>>>> folder ?
>>>>>
>>>>> any idea ?
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>>         
>>>
>>>       
>>     
>
>
>   


Re: why special position for pages, components and ...?

Posted by Mohammad Shamsi <m....@gmail.com>.
but you can see some mechanism in JPA (Java Persistence API).
here you just Annotate a class with @Entity for using it as a Entity in
application.

i think number of entities in a application  is not much less then number of
pages.but i have no  performance problem in my apps using JPA.




On Dec 26, 2007 4:44 PM, Chris Lewis <ch...@bellsouth.net> wrote:

> Aside from the reason I just mentioned, T5 has to know where to look to
> find pages (meaning a java package). With your suggested annotation only
> half the work is done. If I'm not mistaken there is no clean way to
> aggregate all loaded classed in the JVM. If there was, then T5 would
> have to scan *all* of them for your annotation. I'd bet a good deal of
> money that that would cause a performance hit ;-). Having a known set of
> locations to look in solves the performance issue and answers the
> generally unimportant question of where pages should live.
>
> Mohammad Shamsi wrote:
> > i just know that Tapestry use this location for looking up pages.
> > how about a simple Annotation for page classes instead of ?
> > just with using a simple Annotation (for exmaple @Page) for a Page Class
> > we code place classes every where that we like.
> >
> >
> > On Dec 26, 2007 3:16 PM, Chris Lewis <ch...@bellsouth.net> wrote:
> >
> >
> >> Because it removes the necessity to think about something that
> generally
> >> doesn't deserve thought. If you want them elsewhere, make a
> contribution
> >> in your app module.
> >>
> >> chris
> >>
> >> Mohammad Shamsi wrote:
> >>
> >>> Hi,
> >>>
> >>> i want to know that why i should place my pages and components in
> >>>
> >> special
> >>
> >>> folder ?
> >>>
> >>> any idea ?
> >>>
> >>>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >>
> >
> >
> >
>
>


-- 
sincerely yours
M. H. Shamsi

Re: why special position for pages, components and ...?

Posted by Chris Lewis <ch...@bellsouth.net>.
Aside from the reason I just mentioned, T5 has to know where to look to 
find pages (meaning a java package). With your suggested annotation only 
half the work is done. If I'm not mistaken there is no clean way to 
aggregate all loaded classed in the JVM. If there was, then T5 would 
have to scan *all* of them for your annotation. I'd bet a good deal of 
money that that would cause a performance hit ;-). Having a known set of 
locations to look in solves the performance issue and answers the 
generally unimportant question of where pages should live.

Mohammad Shamsi wrote:
> i just know that Tapestry use this location for looking up pages.
> how about a simple Annotation for page classes instead of ?
> just with using a simple Annotation (for exmaple @Page) for a Page Class
> we code place classes every where that we like.
>
>
> On Dec 26, 2007 3:16 PM, Chris Lewis <ch...@bellsouth.net> wrote:
>
>   
>> Because it removes the necessity to think about something that generally
>> doesn't deserve thought. If you want them elsewhere, make a contribution
>> in your app module.
>>
>> chris
>>
>> Mohammad Shamsi wrote:
>>     
>>> Hi,
>>>
>>> i want to know that why i should place my pages and components in
>>>       
>> special
>>     
>>> folder ?
>>>
>>> any idea ?
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>     
>
>
>   


Re: why special position for pages, components and ...?

Posted by Mohammad Shamsi <m....@gmail.com>.
i just know that Tapestry use this location for looking up pages.
how about a simple Annotation for page classes instead of ?
just with using a simple Annotation (for exmaple @Page) for a Page Class
we code place classes every where that we like.


On Dec 26, 2007 3:16 PM, Chris Lewis <ch...@bellsouth.net> wrote:

> Because it removes the necessity to think about something that generally
> doesn't deserve thought. If you want them elsewhere, make a contribution
> in your app module.
>
> chris
>
> Mohammad Shamsi wrote:
> > Hi,
> >
> > i want to know that why i should place my pages and components in
> special
> > folder ?
> >
> > any idea ?
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
sincerely yours
M. H. Shamsi

Re: why special position for pages, components and ...?

Posted by Chris Lewis <ch...@bellsouth.net>.
Because it removes the necessity to think about something that generally 
doesn't deserve thought. If you want them elsewhere, make a contribution 
in your app module.

chris

Mohammad Shamsi wrote:
> Hi,
>
> i want to know that why i should place my pages and components in special
> folder ?
>
> any idea ?
>   


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


Re: why special position for pages, components and ...?

Posted by Howard Lewis Ship <hl...@gmail.com>.
There are a number of reasons.

Convention over configuration.  Your @Page annotation is just another
bit of configuration that is obviated by putting classes in a known
directory.  Although the layout mandated by T5 is required, it is also
the layout that I recommended for T4, even though more configuration
was necessary there.  Rather than having page classes scattered about,
the mandated structure means that there is a very natural and
predictable mapping from class name to logical name (the logical name
being the name that appears in URLs).

Class loading:  As pointed out elsewhere in this thread, having the
specific packages allows Tapestry to greatly reduce the number of
files it must scan at startup time (and then monitor for changes).  T5
page, component and mixin classes must be kept separate for ordinary
classes, as Tapestry does sophisticated conversion of the classes as
they are loaded.

You compared against JPA but JPA does its bytecode enhancement at
build time.  Tapestry does it at runtime, which is integrated into
T5's automatic reloading of changed (component) classes.

On Dec 26, 2007 3:09 AM, Mohammad Shamsi <m....@gmail.com> wrote:
> Hi,
>
> i want to know that why i should place my pages and components in special
> folder ?
>
> any idea ?
> --
> sincerely yours
> M. H. Shamsi
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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