Spec and API review for {Int,Long,Double}SummaryStatistics
Mike Duigou
mike.duigou at oracle.com
Fri Mar 29 15:59:13 PDT 2013
On Mar 29 2013, at 14:28 , Joshua Bloch wrote:
> Mike,
>
> On Fri, Mar 29, 2013 at 12:44 PM, Mike Duigou <mike.duigou at oracle.com> wrote:
>
> On Mar 29 2013, at 11:01 , Kevin Bourrillion wrote:
>
>> Final nit: what's the consistent rule for when exactly this "get" prefix is used?
>
> It's generally used to retrieve state with little or no computation or conversion required to produce the result. "as" or "to" imply conversion. Unadorned names usually imply more computation. Across the JDK it's easy to find counter examples to every rule unfortunately.
>
> Do you have any evidence that this is a rule across the JDK (i.e., that it holds in a significant majority of all cases)?
Empirical evidence, no. A "get" or "put" method that looked like an accessor but actually does significant computation wouldn't pass the sniff test for me though. Similarly an "as" method that wasn't a conversion or returning a view would make me uncomfortable. Same for "to" method that wasn't a conversion.
> I haven't done a methodical study, but it doesn't match my previous assumptions, which are contained in Effective Java.
Presumably you are referring to Item 38. It seems that there is no more consensus now about get/put than when you wrote that. My opinion .... consistency where possible and reasonable but absent of consensus then any other factors which improve clarity, encourage correct usage or increase convenience should be considered.
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20130329/fc0a7e7e/attachment.html
More information about the lambda-libs-spec-experts
mailing list