tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonardo Quijano Vincenzi <leona...@dtqsoftware.com>
Subject Re: [jira] Created: (TAPESTRY-733) Tapestry should call listeners (such as PageBeginRenderListener) in some predefined order
Date Tue, 01 Nov 2005 19:10:38 GMT
Ron Piterman wrote:
> There are two things there:
> The way the components pass the objects is fine - now you have to make 
> sure, for example, that address is not null. Hope I got that right.
> If you decide this logic belongs to the UI...
> placing it in pageBeginRender is a bad idea - Its hard to explain why...
> I use pageBeginRender to initialize rendering cycle, but not business 
> or domain logic.
> What I would do is make proxy methods:
> on the page:
> public Address getAddress() {
>   Address a = getClient().getAddress();
>   if (a == null) {
>     a = new Address();
>     getClient().setAddress(a);
>   }
>   return a;
> }
Then I'd have to init my whole graph on the page. That's exactly what 
I'm trying to avoid. I'm working on a system for an insurance seller. 
So, suppose I have something like this:

Insurance Policy
+ --- Client
        + --- Phones
                 + ---- Phone
                 + ---- Phone
                 + ---- Phone
                 + ---- Phone
        + --- Address
+ --- HomeInsurance
        + --- Conditions
        + --- BuildingAddress



Note that my Address object is reused on Client (as his home address) 
and BuildingAddress (as the building he's insuring, not necessarily his 
home). Putting all that on one page is some monolithic code I'm trying 
to avoid. It's better to let each FormXXX to define its own default values.

Now, if we are concerned about web objects doing business 
initialization, I could always put an object Factory. So, instead of:

address = new Address();

I'd use:

address = getAddressFactory().buildAddress();

But that's the same whether I put it on my page or on the component.
Am I explaining myself?

The bottom line: what I'm trying to avoid is precisely initialization on 
the page. I'd like to have re-usable components that init themselves 
(with a 'new XXX()' or a factory method, I don't care), that I can put 
on a library and reuse on other systems / modules.

*Now, we are going a bit into a layer division discussion. What if my 
sub-components are not business objects, but some web model I'm using? 
(I can't think of an example right now, but there surely must be one). 
The point is that object composition gets a little clunky if I can't 
reliably initialize sub-components based on its parent values.


Ing. Leonardo Quijano Vincenzi
Director T├ęcnico
DTQ Software

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

View raw message