geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Blewitt <>
Subject Re: [General] Container interface and AbstractContainer
Date Thu, 14 Aug 2003 08:32:58 GMT
> I propose that the Container interface looks like:
> Container extends Component
>    Components[] getComponents()
>                 setComponents(Component[])
>                 addComponent(Component)
>                 removeComponent(Component)

Reviewing the code, I can't see why (a) you'd have a setComponents 
method (given that you've already got an add/remove) and the 
getComponent unecesarily returns an array. If you're using a 
collection, then you can simply return a reference to the embedded data 
structure which can then be anything depending on how you want to 
implement it.

Arrays have given me way more headaches in implementation than they 
need to, whereas the only downside of using a Container is that you 
need to throw in a few casts. Given that a number of IDEs will do this 
automatically for you when required, I'd vote for moving over to a 
Collections-based structure instead.

> I also propose that the Component interface has one extra method:
>     String getObjectName();

Why not just getName(), by the way?


View raw message