On Tue, 1 Oct 2002 23:16, Berin Loritsch wrote:
> Leo Sutic wrote:
> > Just one more thing, Peter...
> >
> > I'm fine with the Array lookup.
> >
> > But the Map lookup looks a lot like a ComponentSelector.
>
> I agree here.  I think that was the result of the Map question
> a long time ago.  The biggest problem with the Map I have is that
> it must be an Unmodifiable Map.  Noone should be able to bind
> new services to that Map, or change the bindings that are there.
>
> What does Map provide that XXXSelector doesn't?

* iteration over services. 
* Cleaner semantics (no notion of criteria, construction or alternative 
policys of provisioning as has been with selector)

> > Is the difference that in both cases the component doing
> > the lookup is intended to perform operations on *all*
> > returned services, as opposed to just selecting one of them?
>
> That is a key question.  With arrays, I have a sneaking
> suspiscion that the exact indexes of the components will
> change as we change the number of components.  That can spell
> disastor for someone who is banking on the behavior of
> component 6 returned from an array.  If the array is smaller
> we get an IndexOutOfBoundsException.  If the array has a
> new element inserted at position 5, then what used to be
> 6 is now 7.

You can't stop people from writing bad code ;)

> > That is, while with selector you did:
> >
> >  1. lookup selector.
> >  2. select *one* service.
> >  3. perform operation on service.
>
> Which is what I would expect.  A component should know its
> dependencies up front.

Which is where the different stress is. The multiplicity of dependencies may 
be not known at development time and must be specified at deployment time.

-- 
Cheers,

Peter Donald
-----------------------------------------------
"Only two things are infinite, the universe and 
human stupidity, and I'm not sure about the 
former." -Albert Einstein 
----------------------------------------------- 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to