[infinispan-dev] About size()

Sanne Grinovero sanne at infinispan.org
Tue Oct 7 12:48:53 EDT 2014


On 7 October 2014 15:59, Tristan Tarrant <ttarrant at redhat.com> wrote:
> I'm not sure idiot-proof API is what we want to encourage. I'd rather
> tell users to RTFM.

I'm not thinking about idiots at all. As I said I made such a
decorator for my own sake, as it was handy to spot bad-usage cases I
had missed, or would miss after future refactorings.

I would not underestimate users: if you explain the problem and make
sure people see your message, everyone will be able to find many
clever solutions to get what they need.
On the other hand, relying for a user to read these specific javadocs
is foolish: since you're inheriting the ConcurrentMap contract, people
are going to use the ConcurrentMap type in some cases and clients of
that API will have access to the ConcurrentMap javadoc exclusively.
Maybe it's even code which was written before the introduction of
Infinispan in a project, or written by a team which had never heard of
Infinispan... you know, people make expecations out of typesafety.

You could certainly put a link to TFM in the exception message.

Sanne


>
> Tristan
>
> On 07/10/14 16:23, Sanne Grinovero wrote:
>> On 7 October 2014 14:42, Radim Vansa <rvansa at redhat.com> wrote:
>>> Considering the frequency of "How do I get the number of entries in
>>> cache", "How do I get all keys" on all forums, I think that backing to
>>> runtime exception would not satisfy the users.
>> Correct but when they get to ask the right question, that's usually
>> after several hours of debugging and swearing.
>> With an immediate exception, they get immediate advice and hopefully a
>> hint of where to look in the docs for the special methods like
>> statistics, disabling the exception-throwing decorator, or implement
>> their own M/R job with the exact flags they need.
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>>
>>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev


More information about the infinispan-dev mailing list