[concurrency-interest] java.util.collections

Doug Lea dl@cs.oswego.edu
Wed, 11 Feb 2004 10:03:04 -0500


> There at least 2 types of Java developers:

Hoping to preempt another different-types-of-developers discussion,
here's a different view.  In retrospect, I guess the API design
philosphy in effect here is an "obviousness rule"; something like:

  A JDK API should be easy to use only if it always does what someone
  otherwise unfamiliar with it would expect it to do.  If you cannot
  make an API sufficiently obvious, then you should either make it so
  hard to use that only experts will try to use it, or leave it out
  entirely.

So, in the case of concurrent maps via read-write locks, any expert
developer can do this themselves, especially given the guidance we
provide. They'll be unhappy that they are forced to do something so
tedious. But the net result is probably better this way than if we
made it too easy to apply concurrentMaps to, for example, those Apache
commons collections that they wouldn't work right for.

(On the other hand, classes like AbstractQueuedSynchronizer, which
will do what you want only after hard work and experimentation, are so
scary-looking that no one is going to try to use them by accident.)

-Doug