Stephen Colebourne wrote:

...

From: "paulo gaspar" <"paulo gaspar">


IMO, the collections package:
1) should have really commonly used collections that are missing on the
java.util package and also
some usefull collections building blocks for especial cases;
2) should NOT be a contest to implement all possible classes that have
something to do (even
remotedly) with collections, doesn't mater how special they might be.


#1 is not a bad aim for [collections], the trouble is everyone will define
it differently. And always remember that [collections] was originally just a
dumping ground for other peoples collections. Only now is it starting to
become complete in its own right. #2 is perception, rather than reality
IMHO.


Yeah, #1 is good... in principle. =;o)

...but #2 is a very strong perception, smelling like "real reality", to me.

Examples of 1) that I like:
- The o.a.c.collections.map.Abstract* classes, which are very useful
building blocks;
- o.a.c.collections.map.TypedMap, which solves a very common problem,
before we all use JDK1.5.


Great! But I'll bet that others would say the TypedMap shouldn't exist at
all. And BTW, TypedMap uses PredicatedMap as its implementation, so they're
included too;-)


By need or paranoia, many people will use a "TypedMap" repeatedly if they know they have one.

But having a Predicate interface does NOT mean you need to have all those functors!!!

Examples of 2) that I DISlike:
- o.a.c.collections.map.Flat3Map??? WTF? How many humans use that?


Well I know it is in use as I've had, and fixed, a bug report against it. If
you want a small map that is very memory, performance and garbage collector
efficient this is it.


I am sure all the weirdest collections were used at least once. But should that be enough?

I already told you that I already had use for a couple of the weirdest collections in this package,
BUT I still think they are not worth being there.


- ALL the Unmodifiable crap, since its only advantage over the
java.util.Collections.unmodifiable*() methods is the Unmodifiable
marker interface, and that
(the marker interface) is something most apps don't need, and for
those who need, it is easy to implement;


I can understand this. The reason the classes exist is for completeness and
practicality. [collections] has interfaces that are not in the JDK, and they
need unmodifiable decorators (which aren't in the JDK). Since these 'extra
interface' unmodifiable classes got written it made sense to complete the
set - also, the map implementations often need Set and Collection
implementations anyway. Finally, there is the ability to add a little extra
functionality - Unmodifiable, and support for extracting the decorated
collection to recreate the BoundedCollection interface (try doing that with
the JDK).


But ONLY those not-in-JDK need unmodifiable decorators.

Completness is often a weak reason for too much featuritis/crap.

I am not sure that being able to extract the decorated object is a feature. I would qualify it as a Bug
in most of the contexts where I use such thing.
- E.g.: in a IoC design, if I give to some component a UnmodifiableMap it is usually because I
REALLY, REALLY want to avoid any possibility of that component's code being able to change
the decorated Map.



- All the o.a.c.collections.functors stuff. This is stuff for a very
specific class of apps! Most
useful uses of this sh*t are related with tools that have some
visual/xml/whatever way of
composing things. Way soes the rest of the human race have to put up
with all of this?


History. [collections] has had functors in from the start. I would never
have added them, but they came before my time (a separate commons project
for all the functor stuff would have made more sense). However, as they were
in there we had repeated requests for default implementations, so they got
added. Would you deny user requests?


I am not saying that you should deny anything. What I am saying is that you should not impose so
much.


This means that I am not against having even the incredible Flat3Map packaged in some way. My
problem is that I am overloaded with so much stuff if I want to use the most "obvious" and
"common" collections.


My dream is that Collections would be split in smaller subprojects, corresponding to smaller
packages (and docs/javadocs) to deal with. A big all-in-one package, compatible with the current
monster-jar should still exist.


I would just like to have an easy "standard" alternative to the monster jar.




- The o.a.c.collections.comparators. Just like the above. Even because
comparators SHOULD
...


Fine, you use one, but you might use another. [collections] can't judge
based on what one user wants, but on what the balance of users want. And
again, comparators have existed in [collections] right from the start.


IMO, dividing would still make everybody happy.
=:o)



IMO, what would make sence would be to have:
1) A core Collections package with the really common stuff + building
blocks that ease the work
of building custom/specific collections related stuff;
2) A repository of the weird packages where anyone could pick one of the
less common bits.
...


The key phrase here is 'with the really common stuff'. Who defines that?


Dividing with care, by "theme", can also solve this.

...
BTW, some suggested additions to collections have been rejected - Trie for
example. Its always a fine balance.


I was not implying this is easy. There is a reason why I became so quiet here during the last couple
of years...
=;o)


Having said all that, it must be born in mind that [collections], like
[lang], operates in two ways. The first is as a jar file dependency. For
that it requires a good package layout, complete and logical set of classes
(no holes) and clear docs.


This (no holes) thing is also something that must be taken with a grain of salt...

The second usage is as a cut and paste of individual classes to other
projects. This is happening with [beanutils] and [digester] where they only
ever referred to one or two collection classes and the dependency was alway
ridiculous. I have no problem with taking a collection class and embedding
it in another project, so long as the license conditions are met and the
package name is changed.


The license warrants that possibility, of course.

Anyway, as I said at the start, its good to have the feedback, even if you
believe that we have it totally wrong ;-)


I never meant that (the "tottaly wrong" bit)..

And I see improvement since last time I looked at collections with some attention (when the
primitives stuff was still on the mix and so), which was a really scary experience!


Now it was not so bad!
=;o)

Seriously, not only do I see the primites out, but I also have the idea that everything is better
placed and fits better together. Last time I was just going to quit using Collections, now I am taking
the time to bother you into providing alternative packaging.
=:oD


Stephen


Paulo Gaspar


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



Reply via email to