commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@eurobell.co.uk>
Subject Re: [collections] - Few more collections for the masses... (impor tant for Struts view objects, maybe other projects)
Date Sat, 18 May 2002 10:04:03 GMT
I tried to suggest to Sun a while back that it should add a Factory
interface to the JDK (What I really wanted was a way to instantiate
interfaces by keyword, but thats another story ;-).

One of the main problems my proposal ran into was that different people kept
on coming up with different ways to define a factory. The interface below is
the simplest, but you could argue that
public interface Factory {
    Object createObject(Object param);
}
is more flexible. Of course, its even more vague...

I do agree with there being a Factory interface in commons. But maybe
collections isn't the right part? If it was in Java then surely it would be
in java.lang?

Just my thoughts.
Stephen

From: James Strachan <james_strachan@yahoo.co.uk>
To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
Sent: Friday, May 17, 2002 6:54 PM
Subject: Re: [collections] - Few more collections for the masses... (impor
tant for Struts view objects, maybe other projects)


>
> > > public interface Factory {
> > >     Object createObject();
> > > }
> >
> > Christopher Marshal's proposed patch to SoftRefHashMap also uses more or
> > less the exact same interface; seems a useful addition, though
agonizingly
> > vague.
>
> I like the vagueness of it. Sometimes vague, loose interfaces can be a
good
> thing. Afterall Iterator, Predicate, Transformer are all nice and vague;
> easy to plug stuff in, low assumptions/requirements on implementators,
> loosely coupled etc.
>
> I'm sure the collections library will find other uses for a factory of
> objects (though I wonder how context might be dependent, such as the
current
> index/key of the collection on which to create a new element).
>
> > We'd probably want a reflection-based default implementation somewhere.
>
> Agreed.
>
> James
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>
>
>


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


Mime
View raw message