avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <jeremias.mae...@outline.ch>
Subject Re: Best Practices: Component/Block
Date Tue, 08 Jan 2002 10:15:42 GMT
Thanks, Paul and Peter, for your answers!

On Tue, 8 Jan 2002 20:06:43 +1100 Peter Donald wrote:
> On Tue, 8 Jan 2002 19:45, Jeremias Maerki wrote:
> > After having learned to extend Work interfaces from the Component
> > interface, I've noticed that TimeScheduler does not yet follow this rule.
> > Instead the implementation implements Component/Block.
> 
> Im not sure I follow you. Generally none of my work interfaces extend 
> Component/Block because I though that was good practice ;)
> 
> I must have missed the discussion where it was decided that this is bad - 
> could you give me a pointer to it ?

It all started with my mail "XPathProcessor and implementations"
(yesterday). Carsten pointed out to me that work interfaces should
extend Component. I've looked up the latest "Developing with Avalon"
where I saw a new entry in "Best Practices" (page 22): "Do extend the
Component interface if possible". Don't know when this was discussed on
the list, though. Berin?

So I found that Cornerstone's TimeScheduler does exactly what I need and
found out that it's interface does not extend Component. I'm using it in
ExcaliburComponentManager, so it may not be entirely right, what I'm
doing here, but it works for me.

> > Therefore, I have looked around in Cornerstone for similar cases. Below
> > is a list of stuff I have found. I'm not sure that I have seen everything
> > and I haven't checked the apps directory, nor Excalibur in general. Some
> > interfaces have no ROLE constant. I have added a comment where I think a
> > ROLE constant should be added.
> 
> ROLEs should probably be added - mainly for convenience sake.

:-)

> > Not being a Avalon pro (yet), I may be wrong about this. But if I am, it
> > would be good if someone could update the components so all follow the
> > same conventions.
> >
> > Since Block extends Component I'm wondering if the same rules (as for
> > Component) should apply to Block as well.
> 
> Not sure - Block and Component are in the same family of interfaces so should 
> behave the same. Here is my breakdown of interfaces
> 
> 1. Structural: Component, Block
> 2. Lifecycle: LogEnabled, Initializable, Configurable, Startable etc
> 3. Service/Work/Role: ConnectionManager, ARMIExporter, PacketManager etc
> 
> The implementation generally "implements" 
> 1 x (1)
> 0-9 x (2)
> 0+ x (3)  <--- however usually there is only 1 except in odd circumstances

That's also my view on it.

> > Cornerstone:
> > Classes/interfaces implementing Component:
> > org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory
> > (no ROLE constant)
> 
> That has no ROLE constant because it is never placed into a ComponentManager 
> and thus never needs to be retrieved from one - it is also not required to be 
> a Component.

You're right, of course.

Cheers,
Jeremias Märki

mailto:jeremias.maerki@outline.ch

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
Internet http://www.outline.ch


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message