[concurrency-interest] RFC -- Java7 java.util.concurrent plans

Endre Stølsvik Online at stolsvik.com
Thu Dec 11 12:37:21 EST 2008


On Wed, Dec 10, 2008 at 17:02, Joe Bowbeer <joe.bowbeer at gmail.com> wrote:
> On Wed, Dec 10, 2008 at 7:43 AM, Bob Lee wrote:
>>
>> On Tue, Dec 9, 2008 at 4:35 PM, Doug Lea wrote:
>>>
>>> 3. ConcurrentReferenceHashMap
>>>   A concurrent hash map allowing weak, soft, etc keys and values.
>>
>> BTW, I like the name "ReferenceMap" better.
>>   - It's obviously concurrent because it's in the "concurrent" package.
>>   - It doesn't makes sense to use anything but a hash-based implementation
>> with references.
>>   - We won't want a non-concurrent reference map because it will retain
>> garbage for too long.
>>   - I like shorter names.
>> Bob
>
> I like shorter names, but I also like consistency.
>
> ConcurrentReferenceHashMap is more consistent with the naming of its sibling
> classes, such as ConcurrentHashMap, whereas ReferenceMap is more consistent
> with the naming of interfaces.

Agree - consistency and clarity. IMO, this is way more important than
the 'spoken name argument' that Bob gives - it is really not that
often I tell Joe to use a particular class - it is much more often I
have to understand a type of a variable, remember a name, read the
code. I find it easier to remember a clear, consistent name, than a
"catchy" one - like in what aspects of its function was it they had
left out in that name? The "Concurrent" or "Hash" aspect? Ah, both,
actually. I find it annoying to have to check the package name to
understand a class's function. On the point of "brain parsing time"
that can be raised in such naming discussion, it is shown (!) that we
humans tend to parse entire words as an image, rather than reading
each letter (which actually gives an important naming-argument: Don't
let names be the same length and visually look the same). On writing
time, one code in IDE's, not notepad. Lastly, taking this shortening
logic further, one will end up with name clashes and hence
misunderstandings, like in "Awh, damn, it is a NORMAL DingDong, not
the package.blue version - no wonder everything crashes!".

Endre.


More information about the Concurrency-interest mailing list