commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruce Eckel" <Br...@EckelObjects.com>
Subject Re: [collections] Primitive collections
Date Mon, 14 Oct 2002 20:47:05 GMT
I'm copying a message I just sent to Stephen:

Unfortunate. I have noted this tendency throughout Java's lifetime,
within Sun, to make decisions and not really review them because of
a percieved need to rush something out. As a result, Java is filled
with poor design decisions, and often foibles (for example: not
using upper case for constants everywhere -- something that a
simple design review would have caught). And then, once it has been
rushed out the door, it's considered "cast in stone" so the baggage
is carried forever. I don't know if what you're doing allows for
subtraction of classes if better ideas occur in the future, but if
not it's awfully easy to accrete poor designs.

I suspect there's a design that would allow consistent names to be
used (add(), get()), but also to be able to treat something as a
real Collection or Map (actually, if you're using addInt() it's not
clear to me how you could use the class as a real Collection or Map
anyway, since you can't use the substitution principle because
you've extended the interface). Something Proxy-ish or Adapter-ish
comes to mind; at least, some form of composition.

*********** REPLY SEPARATOR  ***********

On 10/14/2002 at 9:29 PM Stephen Colebourne wrote:

>There has been talk of adding parallel interfaces, however, these
would
>use
>the addInt() etc. convention. Personally I much prefer the ability
to use
>these objects as genuine Lists via transparant boxing. I would
however
>strongly support the addition of addInt() style parallel
interfaces.
>
>Unfortunately, your request arrives at a difficult time to be
>considered/debated. The code for the next release (the first to
include
>primitives) is now considered frozen, and due for Release
Candidate stage
>on
>Thursday, followed by release proper on Monday.
>
>As release manager, my intention is to proceed with the release as
is. The
>timescale is dictated by other projects waiting on the code. And
the
>primitives code will be valuable and useful defined as is.
>
>I will be notifying the commons-dev list of the discussion, to
enable
>others
>to comment before the Wednesday midnight UTC boundary. Please feel
free to
>join the discussion there, or if you wish, help code the
interfaces ;-)
>
>Stephen
>
>----- Original Message -----
>From: "Bruce Eckel" <Bruce@EckelObjects.com>
>
>
>> I think you should implement a parallel interface hierarchy:
>> PrimitiveCollection, PrimitiveList, PrimitiveSet, PrimitiveMap.
I
>> think it's a lot more important to have the same method names as
>> the Java collection hierarchy.
>>

*********** REPLY SEPARATOR  ***********

On 10/14/2002 at 9:34 PM Stephen Colebourne wrote:

>A debate has recently arrived at my doors privately from Bruce
Eckel
>related
>to the primitive collections:
>
>Bruce has argued that the primitive method names should be the
same as the
>Object ones from List, and the primitive classes should thus not
implement
>List but a new interface PrimitiveIntList etc.
>
>Due to the current freeze on [collections] for release and need
for a
>release, I (as release manager) have decided to restrict debate on
this and
>proceed with the primitive collections as is.
>
>Any objections??
>
>Stephen
>
>
>Original debate:
>----- Original Message -----
>From: "Bruce Eckel" <Bruce@EckelObjects.com>
>> I think you should implement a parallel interface hierarchy:
>> PrimitiveCollection, PrimitiveList, PrimitiveSet, PrimitiveMap.
I
>> think it's a lot more important to have the same method names as
>> the Java collection hierarchy.
>>
>> *********** REPLY SEPARATOR  ***********
>>
>> On 10/14/2002 at 5:46 PM scolebourne@btopenworld.com wrote:
>>
>> >The reason for the method names is that the classes implement
the
>> List
>> >interface (returning Integer objects). Clearly a different
method
>> name is
>> >required as int and Object are incompatable types.
>> >
>> >At present, we have lists for most primitive types. We do not
have
>> Map
>> >implementations however, and this will hopefully be addresed by
>> someone
>> >soon.
>> >
>> >Stephen
>> >
>> >>  from:    Bruce Eckel <Bruce@EckelObjects.com>
>> >>
>> >> Any hope for review/refactoring on these things? For example,
>> the
>> >> IntArrayList uses 'Int' everywhere in its method names. For
>> >> example:
>> >> addInt(), getInt(), containsInt(), indexOfInt(), and on.
>> >> why not just follow the existing container library rather
than
>> >> forcing people to learn something new and redundant? e.g.:
>> >> add(), get(), contains(), indexOf()
>> >> If I create a container of int, then that's what I expect to
>> add()
>> >> and get().
>> >>
>> >> *********** REPLY SEPARATOR  ***********
>> >>
>> >> On 10/14/2002 at 8:28 AM Henri Yandell wrote:
>> >>
>> >> >Have a look at:
>> >> >
>> >>
>>
>http://cvs.apache.org/viewcvs.cgi/jakarta-commons/collections/src/j

>>
>> >> ava/org/apache/commons/collections/primitives/
>> >> >
>> >> >Stephen Colebourne's preparing a new release of Collections.
>> >> Stephen, will
>> >> >the primitives be going in that release?
>> >> >
>> >> >Hen
>> >> >
>> >> >[just caught James' reply, so will limit this going to
>> everyone.
>> >> The link
>> >> >above is the code in cvs James mentions]
>> >> >
>> >> >On Mon, 14 Oct 2002, Bruce Eckel wrote:
>> >> >
>> >> >> As I was working on "Thinking in Java, 3rd edition" I read
>> the
>> >> part
>> >> >> about how collections don't handle primitive types. It
also
>> >> appears
>> >> >> that this will *not* be addressed with Generics in JDK 1.5
--
>> >> that
>> >> >> is, Generics will only handle objects and will not be able
to
>> be
>> >> >> instantiated for primitives, as templates can be with C  .
>> >> >>
>> >> >> Have you thought about creating versions of the
Collections
>> for
>> >> >> primitive types?



Most current information can be found at:
http://www.mindview.net/Etc/notes.html
===================
Bruce Eckel    http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java 2e" & "Thinking
in C++ 2e"
Please subscribe to my free newsletter -- just send any email to:
join-eckel-oo-programming@earth.lyris.net
My schedule can be found at:
http://www.mindview.net/Calendar
===================



--
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