Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36236

Re: Uppercase methods names

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Uppercase methods names
Date 2017-01-31 12:40 -0500
Organization A noiseless patient Spider
Message-ID <o6qi2f$85f$1@dont-email.me> (permalink)
References <namens-20170131023341@ram.dialup.fu-berlin.de> <o6q2h0$clu$1@dont-email.me>

Show all headers | View raw


On 1/31/2017 8:14 AM, Eric Sosman wrote:
> On 1/30/2017 8:36 PM, Stefan Ram wrote:
>>   This is not mentioned in JLS 6.1, but are
>>
>> public static int java.awt.Color.HSBtoRGB(float,float,float)
>> public static double java.lang.Math.IEEEremainder(double,double)
>> public static float[] java.awt.Color.RGBtoHSB(int,int,int,float[])
>> public static long java.util.Date.UTC(int,int,int,int,int,int)
>> public static native double
>> java.lang.StrictMath.IEEEremainder(double,double)
>>
>>   enough prior art to derive a rule:
>>
>>       »When a method name starts with an acronym that usually
>>       is written in all-upperase, it is still written in
>>       all-uppercase when it appears at the start of a method
>>       name«?
>
>     Why bother deriving a RULE!!! from the names of a mere six
> methods, one of them deprecated?

     Just for fun, I wrote a little program to examine the method
names in Java 1.8.0_121's rt.jar.  Considering only the public and
protected methods of public classes and interfaces, there are 31941
methods of which ten have names beginning with an upper-case letter:

java.awt.GridBagLayout.AdjustForGravity
java.awt.GridBagLayout.ArrangeGrid
java.awt.GridBagLayout.GetLayoutInfo
java.awt.GridBagLayout.GetMinSize

-- These four are not actually deprecated, but are "obsolete and
supplied for backwards compatibility only."  Programmers are
encouraged to use initial-lower-case equivalents instead.

javax.swing.tree.DefaultTreeCellEditor$EditorContainer.EditorContainer

-- An oddity.  The JavaDoc for this method is completely empty, and
a comment in the source says "This should not be used."

java.awt.Color.HSBtoRGB
java.awt.Color.RGBtoHSB
java.util.Date.UTC
java.lang.Math.IEEEremainder
java.lang.StrictMath.IEEEremainder

-- These are the five (not six; I can't count) noted by Stefan.

     Summary: There are ten exceptions to the initial-lower-case
standard, amounting to thirty-one thousandths of one percent of
all public and protected method names.

     Summary II: A rule that explains only half of thirty-one
thousandths of one percent of cases is more trouble than it's
worth.  (IMHO, YMMV)

-- 
esosman@comcast-dot-net.invalid
Fourteen hundred fifty days to go.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Uppercase methods names Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-01-31 08:14 -0500
  Re: Uppercase methods names Eric Douglas <e.d.programmer@gmail.com> - 2017-01-31 06:02 -0800
  Re: Uppercase methods names Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-01-31 12:40 -0500

csiph-web