[concurrency-interest] ConcurrentHashMapV8

Kasper Nielsen kasper at kav.dk
Mon Oct 3 14:07:15 EDT 2011


On 03-10-2011 19:20, √iktor Ҡlang wrote:
>     Adding 1 interface is better then adding 2.
>
>
> According to what definition of "better"? To be honest, if we'd have
> more fine grained interfaces in Java, we would probably not be in this
> situation we are in today, where the Collection interface is so broad
> you oftentimes have to choose between performance or add
> UnsupportedOperationExceptions.
> If we'd have more fine-grained interfaces (or typeclasses) we could be
> more selective in what data gets exposed.

According to the design goals of the Java collection framework.
http://download.oracle.com/javase/1.4.2/docs/guide/collections/overview.html, 
1 interface is "better" than 2.

I know things are probably different in Scala land. But i do think the 
designers of the Java collection API made the right choices with regards 
to this. Is it perfect? no. But I would rather have 10 interfaces with 
optional operations not capturing distinctions such as modifiability 
than 20 - 30 interfaces that did. Others might disagree, but I really do 
not think it was a mistake as you are implying.

Do it places a burden on implementors, yes. But for every time there is 
one person implementing the Collection interface there are probably 
thousands that are merely users of that interface.

I really think too many API designers think too much on taxonomy and to 
little of the "conceptual weight" of the APIs they design.

Hey! there are users that need to figure out how that APIs work. Whether 
there are 10 interfaces or 20 - 30 interfaces matters to them.

Anyway, this is probably not the right forum do discuss this. And we are 
probably not going to come to any kind of agreement on this anyway.

cheers
   Kasper


More information about the Concurrency-interest mailing list