You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship" <hl...@attbi.com> on 2003/02/01 17:08:20 UTC
Use of interfaces ...
Just a random thought ...
Tapestry uses a few key interfaces: IComponent, IPage, IEngine,
IRequestCycle being the main ones.
In theory, you could brew up your own IComponent implementation, not
AbstractComponent.
Increasingly, though, the framework is making expections that your component
classes inherit from AbstractComponent. For example, the new class
enhancement code expects that fireObservedChange() (provided by
AbstractComponent) is provided by a superclass.
Every once and a while, I think about scrapping IComponent and IPage,
renaming AbstractComponent to Component (or TapestryComponent, or
WebComponent), and likewise of AbstractPage.
There are also theoretical performance improvements in shifting from
interfaces to abstract base classes. Method invocation against a class is
more efficient and easier for Hotspot to optimize than invocations against
an interface (in fact, there are different bytecodes for invoking a virtual
method vs. invoking an interface method).
At some point, I'll have an environment where I can do performance testing
... perhaps I'll match them up against each other!
BTW ... is my sig (below) too obnoxious?
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry
Re: Use of interfaces ...
Posted by Colin Sampaleanu <co...@exis.com>.
Generally, I think this would be a step in the wrong direction.
Aside from other considerations, I wouldn't overlook one aspect of
interfaces, that they make testing (via mock objects, etc.) much easier.
You can take a piece of code, and when it is dealing mostly with objects
it talks to via interfaces, very easily stress it outside of its normal
environment. It's a drag to have to drop something in a web container to
test it out. If you leave things as an interface, and an abstract class
that will be used most of the time, when somebody needs to do a test
they can instead implement only the portions of the interface that are
really needed for the test.
W/regards to performance, the VM has gotten a lot faster at some
operations. Reflection for example, which used to be something like 30x
slower than a normal method call, is only 1.5x slower in the 1.4 VM. I
would be very surprised if this aspect made much of a difference,
compared to other things that a Tapestry application might typically do,
such as hitting a database.
Howard M. Lewis Ship wrote:
>Just a random thought ...
>
>Tapestry uses a few key interfaces: IComponent, IPage, IEngine,
>IRequestCycle being the main ones.
>
>In theory, you could brew up your own IComponent implementation, not
>AbstractComponent.
>
>Increasingly, though, the framework is making expections that your component
>classes inherit from AbstractComponent. For example, the new class
>enhancement code expects that fireObservedChange() (provided by
>AbstractComponent) is provided by a superclass.
>
>Every once and a while, I think about scrapping IComponent and IPage,
>renaming AbstractComponent to Component (or TapestryComponent, or
>WebComponent), and likewise of AbstractPage.
>
>There are also theoretical performance improvements in shifting from
>interfaces to abstract base classes. Method invocation against a class is
>more efficient and easier for Hotspot to optimize than invocations against
>an interface (in fact, there are different bytecodes for invoking a virtual
>method vs. invoking an interface method).
>
>At some point, I'll have an environment where I can do performance testing
>... perhaps I'll match them up against each other!
>
>
Re: Use of interfaces ...
Posted by Geoff Longman <gl...@intelligentworks.com>.
Actually, I avoid titles like the plague. When I was in the army, Sergeant
was nice but now Developer or Geoff will do.
> >
> > Call yourself whattever you like, you've earned it. Maybe I'll call
> > myself
> > the "Imperious Leader" of Spindle. riiight.
>
> How about "Benign Dictator"? :))
>
> best regards,
> viktor
>
> --
> http://fastmail.fm - Choose from over 50 domains or use your own
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
>
Re: Use of interfaces ...
Posted by Viktor Szathmary <ph...@imapmail.org>.
On Sat, 1 Feb 2003 11:08:22 -0500, "Geoff Longman"
<gl...@intelligentworks.com> said:
> I think you should find out how ofter people are brewing up thier own
> component classes.
i don't think this happens very often (if at all :), since there are so
many expectations on what to implement... OTOH, interfaces are useful, as
they provide more opportunities for extending things in an unanticipated
way (eg. think dynamic proxy interceptors)... also, i think perhaps
cutting some large interfaces into more manageable pieces would be more
useful, and then using composition with those... if you think about it,
it also has much to do with what I was ranting about sometimes, that
right now there's just too much behavior being inherited, leaving little
room for experimenting with other ways of (non-)pooling for example.
> If your performance tests are positive this could offset some of the
> sacrifices made in the name of useablilty.
I expect you will find other hotspot to optimize performance on, and the
interface/concrete call difference will be negligible.
> >Howard M. Lewis Ship
> >Creator, Tapestry: Java Web Components
> >http://jakarta.apache.org/proposals/tapestry
>
> Call yourself whattever you like, you've earned it. Maybe I'll call
> myself
> the "Imperious Leader" of Spindle. riiight.
How about "Benign Dictator"? :))
best regards,
viktor
--
http://fastmail.fm - Choose from over 50 domains or use your own
Re: Use of interfaces ...
Posted by Geoff Longman <gl...@intelligentworks.com>.
I think you should find out how ofter people are brewing up thier own
component classes.
If your performance tests are positive this could offset some of the
sacrifices made in the name of useablilty.
>BTW ... is my sig (below) too obnoxious?
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/proposals/tapestry
Call yourself whattever you like, you've earned it. Maybe I'll call myself
the "Imperious Leader" of Spindle. riiight.
Geoff