Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36236
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Uppercase methods names |
| Date | Tue, 31 Jan 2017 12:40:05 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 59 |
| Message-ID | <o6qi2f$85f$1@dont-email.me> (permalink) |
| References | <namens-20170131023341@ram.dialup.fu-berlin.de> <o6q2h0$clu$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Tue, 31 Jan 2017 17:38:23 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="d3d3867b4df1c46566deef749362834e"; logging-data="8367"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1919mf3qYWr42CuioaXpNYe" |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
| In-Reply-To | <o6q2h0$clu$1@dont-email.me> |
| Cancel-Lock | sha1:1+CKE0zG5eiEGEV6buvLmlW8wxQ= |
| Xref | csiph.com comp.lang.java.programmer:36236 |
Show key headers only | 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
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