Howard Lewis Ship <hlship <at> gmail.com> writes:
> There's a lot of API inherited from the base class that, in most
> cases, the user class has no need or rigtht to access. For example,
> from the user class point of view, the structure of the component and
> it's specification should be immutable, yet there are many add and set
> methods exposed, waiting to be mis-used.
Those methods seem to be used by the PageLoader only. In that case, why
not revert their relationship: Let the component call the PageLoader in
its constructor:
public AbstractComponent(IPageLoader pageLoader) {
this.id = pageLoader.getId();
this.assets = pageLoader.getAssets();
...
}
Then all the add and set methods can be eliminated or made private.
> As has been seen in the last couple of years with the interest in
> POJOs, inheritance is problematic; it increases the "surface area" of
> the API.
I think the major benefit of using POJO is about testing. I think it
is more important to make sure the IRequestCycle and other related
interfaces are sufficiently isolated and coarse grained so that it
becomes easier to provide mock implementations to test a component
along with its child components. I think this is more important than
the inheritance vs delegation issue.
--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]