You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kai Weber <ka...@glorybox.de> on 2009/06/24 14:34:44 UTC

Architecture: how much logic should a component contain

Hi,

what do you think, how much of logic a component should contain?

Say I have a service which retrieves values from somewhere. Should I 
make this service available in the component or the page containing the 
component and setting the values via a @Parameter variable in the component.

At the moment I see my components more as value providers for my (H)TML 
view logic and have all calls to backend services in the pages. But what 
do others do and think?

Regards, Kai

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


Re: Architecture: how much logic should a component contain

Posted by Howard Lewis Ship <hl...@gmail.com>.
I think you are on the right track ... however, when doing demos and
tutorials I often have a bit of business logic (i.e., Hibernate queries) in
my pages, where I can live-reload them. One of my labs is to refactor that
into a shared service.

My point is, don't over-engineer early on, do what is convienient and then
refactor (mercilessly!) later.

On Wed, Jun 24, 2009 at 5:34 AM, Kai Weber <ka...@glorybox.de> wrote:

> Hi,
>
> what do you think, how much of logic a component should contain?
>
> Say I have a service which retrieves values from somewhere. Should I make
> this service available in the component or the page containing the component
> and setting the values via a @Parameter variable in the component.
>
> At the moment I see my components more as value providers for my (H)TML
> view logic and have all calls to backend services in the pages. But what do
> others do and think?
>
> Regards, Kai
>
> ---------------------------------------------------------------------
> 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
Director of Open Source Technology at Formos

Re: Architecture: how much logic should a component contain

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, Jun 24, 2009 at 9:34 AM, Kai Weber<ka...@glorybox.de> wrote:
> Hi,

Hi!

> what do you think, how much of logic a component should contain?

I completely agree with Peter that no business or data access logic
nor should be in components or pages.

> Say I have a service which retrieves values from somewhere. Should I make
> this service available in the component or the page containing the component
> and setting the values via a @Parameter variable in the component.

It depends on how self-contained the component is. If it is used to
show some information that is page-independent, it retrieves this
information from the service directly. One example would be a tag
cloud component in a blog package. The component parameters would be
used to fine-tune the component rendering (maximum number of tags, for
example).

-- 
Thiago

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


Re: Architecture: how much logic should a component contain

Posted by Angelo Chen <an...@yahoo.com.hk>.
I'd prefer to put as many logic as possible in the service, component should
be like page, for the view tier only, it is easy to test service.


Kai Weber-2 wrote:
> 
> Hi,
> 
> what do you think, how much of logic a component should contain?
> 
> Say I have a service which retrieves values from somewhere. Should I 
> make this service available in the component or the page containing the 
> component and setting the values via a @Parameter variable in the
> component.
> 
> At the moment I see my components more as value providers for my (H)TML 
> view logic and have all calls to backend services in the pages. But what 
> do others do and think?
> 
> Regards, Kai
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Architecture%3A-how-much-logic-should-a-component-contain-tp24183982p24184068.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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