comp.lang.ada
 help / color / mirror / Atom feed
* ISO Studies of underscores vs MixedCase in Ada or C++
@ 2003-09-26  4:32 Andy Glew
  2003-09-26  5:43 ` Attila Feher
                   ` (6 more replies)
  0 siblings, 7 replies; 52+ messages in thread
From: Andy Glew @ 2003-09-26  4:32 UTC (permalink / raw)


I am in search of any rigourous,
scientific, academic or industrial studies
comparing naming conventions in
C++ or similar languages such as
Ada:

Specifically, are names formed with
underscores more or less readable
than names formed with MixedCase
StudlyCaps camelCase?

...and similarly, any measurements
of programmer productivity, bug rate,
etc.; although IMHO readability matters
most.


* Religion - NOT?!

I understand that this is a religious issue
for many programmers, an issue of programming style.
I am not interested in a religious war.
I obviously have my own opinion, but I am
open to scientific evidence.


* Ada Studies?

I thought that I had seen studies like
this in some of the early design documents
for Ada, but I have not been able to find
such references on the web. Which is not
entirely surprising, since Ada was designed
prior to the web.

The Ada 83 and 95 Quality Guidelines recommend
underscores to improve readability, but provide
no source justifying this statement.  


* What such studies might look like

Simple readability and recall:
   - present a test subject with 
     a list of compound words
     formed with underscoresand mixed case
   - remove the list, and ask test subject
     to write it
   - score on accuracy

Program debugging
   - present programs that are otherwise identical,
     differing only in their use of underscores/MixedCase
     to test subject programmers (e.g. a CS class)
   - program has a known bug
   - ask test subjects to find bug
   - score on accuracy locating bug

Cruel TA study:
   - Two sections of a CS class
   - Enforce programming standards,
     underscores vs MixedCase
   - Pose a programming problem
   - Score according to success
     completing assignment

Empirical:
   - Given version control databases
     of large programs, some written in underscore
     style, others in MixedCase
   - Total bug rates normalized by LOC, name count, etc.
   - OR: count only bugs that can be attributed
     (after inspection of checkins) to misnamed variables

For that matter, I would be interested in any surveys
folks may have done that count projects and their
coding standards, possibly weighted
   - open source (e.g. sourceforge)
   - industrial
   - textbooks, weighted by sales
   - websites of coding standards, weighted by Google score...
Although this is less convincing than a rigorous study.


* Explanation of Newsgroups Chosen

I hope it is obvious why I have chosen these
newsgroups to post this search to:

comp.software-eng, comp.programming, 
   - an issue of software engineering
comp.lang.c++, 
   - the language I am most interested in
comp.lang.ada
   - because I vaguely recall historical work



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 Andy Glew
@ 2003-09-26  5:43 ` Attila Feher
  2003-09-26  5:54 ` Jakob Bieling
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 52+ messages in thread
From: Attila Feher @ 2003-09-26  5:43 UTC (permalink / raw)


Andy Glew wrote:
> I am in search of any rigourous,
> scientific, academic or industrial studies
> comparing naming conventions in
> C++ or similar languages such as
[SNIP]

The underscore convention work also in case insensitive languages.

The InnerCaps convention fails to solve the issue of all caps words like
SMTPTCPIPConnection.  Usual solution is to write them wrong as
SmtpTcpIpConnection.

The underscore convention tends to make lines longer, which can have bad
effect on readablity.

IMO it is a personal preference issue, and also an issue of what fonts and
development envirnmoent is in use.

IMO if one has to select *one* convention for a whole company using many
languages then only the underscore one stands.  With InnerCaps there is a
possibility to create hard-to-find name collisions, especially in languages
where the type of variables can change runtime by a simple assignment.

--
Attila aka WW





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 Andy Glew
  2003-09-26  5:43 ` Attila Feher
@ 2003-09-26  5:54 ` Jakob Bieling
  2003-09-26  7:11   ` Matt Gregory
  2003-09-26 13:43   ` Steve
  2003-09-26  7:27 ` Ludovic Brenta
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 52+ messages in thread
From: Jakob Bieling @ 2003-09-26  5:54 UTC (permalink / raw)


"Andy Glew" <andy.glew@amd.com> wrote in message
news:2cfd1a4e.0309252032.3e3c0a1a@posting.google.com...

    [snip]

> Specifically, are names formed with
> underscores more or less readable
> than names formed with MixedCase
> StudlyCaps camelCase?

    Write a large text (several lines) with mixed-case and the same again
with underscores. Then give it people to read and ask them what they find
easier to read. I would not be surprised if the majority favours the text
with underscores.

    [snip]

> The Ada 83 and 95 Quality Guidelines recommend
> underscores to improve readability, but provide
> no source justifying this statement.

    The underscore can easily be view as a space which seperates the words,
whereas mixed-case does not provide a seperation like that, but rather a
'large' here-comes-a-new-word-mark (ie. the captial letter). The problem I
see with this: non-captial letters can be 'large' as well. just have a look
at the 't', 'h' etc, which, imo, does not make reading a mixed-case text
easier.

    Personally, I prefer underscore for the reason above.

Just my .02c
--
jb

(replace y with x if you want to reply by e-mail)





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  5:54 ` Jakob Bieling
@ 2003-09-26  7:11   ` Matt Gregory
  2003-09-26 17:12     ` Matt Gregory
  2003-09-26 13:43   ` Steve
  1 sibling, 1 reply; 52+ messages in thread
From: Matt Gregory @ 2003-09-26  7:11 UTC (permalink / raw)


Jakob Bieling wrote:

>     The underscore can easily be view as a space which seperates the words,
> whereas mixed-case does not provide a seperation like that, but rather a
> 'large' here-comes-a-new-word-mark (ie. the captial letter). The problem I
> see with this: non-captial letters can be 'large' as well. just have a look
> at the 't', 'h' etc, which, imo, does not make reading a mixed-case text
> easier.

I think we just need a programming font that has half-sized underscores
in front of all the capital letters.  That would solve all these problems.
I personally don't like typing underscores, but I agree they are more
readable.  Emacs does have a view-camel-cased-identifiers-as-underscored
mode, so that's a step in the right direction.




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 Andy Glew
  2003-09-26  5:43 ` Attila Feher
  2003-09-26  5:54 ` Jakob Bieling
@ 2003-09-26  7:27 ` Ludovic Brenta
  2003-09-26 15:40   ` Frank J. Lhota
  2003-09-26 16:22 ` Randy King
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 52+ messages in thread
From: Ludovic Brenta @ 2003-09-26  7:27 UTC (permalink / raw)



Personally I prefer underscores, too, and for that reason I really
like Emacs' glasses-mode.  So, use whatever you want, *I* will always
see underscores :)

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  5:54 ` Jakob Bieling
  2003-09-26  7:11   ` Matt Gregory
@ 2003-09-26 13:43   ` Steve
  1 sibling, 0 replies; 52+ messages in thread
From: Steve @ 2003-09-26 13:43 UTC (permalink / raw)


I think a more relevent test would be to give two versions the same code,
one with underscores, one with mixed casing, to different groups of
programmers to analyze.  Include a quiz asking questions about the code.
See which version results in more correct answers, and which version
achieves the answers more quickly.

Steve
(The Duck)

"Jakob Bieling" <netsurf@gmy.net> wrote in message
news:bl0ka8$n7h$07$1@news.t-online.com...
[snip]
>
>     Write a large text (several lines) with mixed-case and the same again
> with underscores. Then give it people to read and ask them what they find
> easier to read. I would not be surprised if the majority favours the text
> with underscores.
>





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  7:27 ` Ludovic Brenta
@ 2003-09-26 15:40   ` Frank J. Lhota
  2003-09-27 11:18     ` Mad Hamish
  2003-09-29 17:34     ` Georg Bauhaus
  0 siblings, 2 replies; 52+ messages in thread
From: Frank J. Lhota @ 2003-09-26 15:40 UTC (permalink / raw)


Underscores are basically a way to provide spaces in an identifier. Since
identifiers are generally phrases (nown phrases for objects, verb phrases
for procedures) and phrases often consist of more than one word, I find the
use of underscores to be quite natural.

The opposing argument is that underscores are too large, and that a case
change is a more readable way to indicate how to divide the decomposition
into words. To me, the upper / lower case method of delineate the words in
an indentifier has always looked like the transcript of a very fast talker.
Yes, you can make out the words, but just barely. Moreover, the use of
letter case to delineate words prohibits any other use of letter case. It
rules out using all caps for a certain category of identifiers, for example.

There is an easy way to test which convention is more readable. Here is one
of Shakespeare's sonnets rendered in the mixed case format:

    FromFairestCreaturesWeDesireIncrease,
    ThatTherebyBeautysRoseMightNeverDie,
    ButAsTheRiperShouldByTimeDecease,
    HisTenderHeirMightBearHisMemory:
    ButThouContractedToThineOwnBrightEyes,
    FeedstThyLightsFlameWithSelfSubstantialFuel,
    MakingAFamineWhereAbundanceLies,
    ThySelfThyFoeToThySweetSelfTooCruel:
    ThouThatArtNowTheWorldsFreshOrnament,
    AndOnlyHeraldToTheGaudySpring,
    WithinThineOwnBudBuriestThyContent,
    AndTenderChurlMakstWasteInNiggarding:
    PityTheWorldOrElseThisGluttonBe,
    ToEatTheWorldsDueByTheGraveAndThee

It may be a matter of taste, but I certainly found the original sonnet to be
more readable and more beautiful.





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 Andy Glew
                   ` (2 preceding siblings ...)
  2003-09-26  7:27 ` Ludovic Brenta
@ 2003-09-26 16:22 ` Randy King
  2003-09-26 16:51   ` Hyman Rosen
  2003-09-26 17:24 ` Jack Klein
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 52+ messages in thread
From: Randy King @ 2003-09-26 16:22 UTC (permalink / raw)


<snip> op <snip>

This is a somwhat offtopic post, but the OP did ask the question about
readability.

Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer
inwaht orredr the ltteers in a wrod are, the olny iprmoetnt tihng is
taht the frist and lsat ltteer be at the rghit pclae. The rset can be a
total mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae
the huamn mnid deos not raed ervey lteter by istlef, butthe wrod as a
wlohe. Aolbsulty amzanig huh?



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 16:22 ` Randy King
@ 2003-09-26 16:51   ` Hyman Rosen
  2003-09-26 18:02     ` Mike Smith
  0 siblings, 1 reply; 52+ messages in thread
From: Hyman Rosen @ 2003-09-26 16:51 UTC (permalink / raw)


Randy King wrote:
> Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer
> inwaht orredr the ltteers in a wrod are, the olny iprmoetnt tihng is
> taht the frist and lsat ltteer be at the rghit pclae. The rset can be a
> total mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae
> the huamn mnid deos not raed ervey lteter by istlef, butthe wrod as a
> wlohe. Aolbsulty amzanig huh?

     "Anidroccg to crad cniyrrag lcitsiugnis planoissefors at an uemannd,
      utisreviny in Bsitirh Cibmuloa, and crartnoy to the duoibus cmials
      of the ueticnd rcraeseh, a slpmie, macinahcel ioisrevnn of ianretnl
      cretcarahs araepps sneiciffut to csufnoe the eadyrevy oekoolnr."




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  7:11   ` Matt Gregory
@ 2003-09-26 17:12     ` Matt Gregory
  2003-09-26 18:25       ` tmoran
  2003-09-26 18:41       ` Michael Feathers
  0 siblings, 2 replies; 52+ messages in thread
From: Matt Gregory @ 2003-09-26 17:12 UTC (permalink / raw)


I wrote:

> I think we just need a programming font that has half-sized underscores
> in front of all the capital letters.  That would solve all these problems.

Nevermind, that was a terrible idea.  It was almost good though.




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 Andy Glew
                   ` (3 preceding siblings ...)
  2003-09-26 16:22 ` Randy King
@ 2003-09-26 17:24 ` Jack Klein
  2003-09-26 17:44   ` Programmer Dude
                     ` (3 more replies)
  2003-10-02  4:20 ` Peter Ammon
  2003-10-08 15:07 ` Isaac Gouy
  6 siblings, 4 replies; 52+ messages in thread
From: Jack Klein @ 2003-09-26 17:24 UTC (permalink / raw)


On 25 Sep 2003 21:32:40 -0700, andy.glew@amd.com (Andy Glew) wrote in
comp.lang.c++:

> I am in search of any rigourous,
> scientific, academic or industrial studies
> comparing naming conventions in
> C++ or similar languages such as
> Ada:
> 
> Specifically, are names formed with
> underscores more or less readable
> than names formed with MixedCase
> StudlyCaps camelCase?

My team is currently working under this guideline as a compromise:

Function names must be CamelMode, but optionally underscores are
allowed, e.g. Camel_Mode.

...or should I say "compromised" guidelines?

Interestingly I see a lot of programmers who prefer CamelMode for
function names, yet prefer under_scores in variable names.  In every
single case where I have checked, the programmer has done at least
some coding for Windows and its Pascal, BASIC, etc., API.  And in
every single case they claim that is not where their style came from.
Go figure.

-- 
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 17:24 ` Jack Klein
@ 2003-09-26 17:44   ` Programmer Dude
  2003-09-27 11:44     ` Gerry Quinn
  2003-09-26 19:57   ` Default User
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 52+ messages in thread
From: Programmer Dude @ 2003-09-26 17:44 UTC (permalink / raw)


Jack Klein wrote:

> Interestingly I see a lot of programmers who prefer CamelMode for
> function names, yet prefer under_scores in variable names.  In every
> single case where I have checked, the programmer has done at least
> some coding for Windows and its Pascal, BASIC, etc., API.  And in
> every single case they claim that is not where their style came from.

I've tried just about every combination over the years.  At one
point it was underscores in function names, not in data names.
OOP added enough other basic types of things it got hard to have
a style for each.  Currently, I use lower_case_with_underscores
for local names and CamelCaseMode for functions/methods and
for global data.

I'm considering switching to Mixed_Case_With_Underscores for
global data.  In fact, with the fairly recent addition of
several new languages to my tool kit, it's probably time to
once again re-think my whole naming convention thing.

-- 
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
|_____________________________________________|_______________________|



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 16:51   ` Hyman Rosen
@ 2003-09-26 18:02     ` Mike Smith
  2003-09-26 19:05       ` Hyman Rosen
  2003-09-26 19:56       ` Default User
  0 siblings, 2 replies; 52+ messages in thread
From: Mike Smith @ 2003-09-26 18:02 UTC (permalink / raw)


Hyman Rosen wrote:

> Randy King wrote:
> 
>> Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer
>> inwaht orredr the ltteers in a wrod are, the olny iprmoetnt tihng is
>> taht the frist and lsat ltteer be at the rghit pclae. The rset can be a
>> total mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae
>> the huamn mnid deos not raed ervey lteter by istlef, butthe wrod as a
>> wlohe. Aolbsulty amzanig huh?
> 
> 
>     "Anidroccg to crad cniyrrag lcitsiugnis planoissefors at an uemannd,
>      utisreviny in Bsitirh Cibmuloa, and crartnoy to the duoibus cmials
>      of the ueticnd rcraeseh, a slpmie, macinahcel ioisrevnn of ianretnl
>      cretcarahs araepps sneiciffut to csufnoe the eadyrevy oekoolnr."

Yes, it's possible to take it *too* far.  But I *was* able to read the 
quoted text at maybe half the speed at which I could have read it if it 
were spelled correctly.  And the text in Randy King's post is even more 
readable than that - I can read it at almost full speed.

--
Mike Smith




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 17:12     ` Matt Gregory
@ 2003-09-26 18:25       ` tmoran
  2003-09-26 18:41       ` Michael Feathers
  1 sibling, 0 replies; 52+ messages in thread
From: tmoran @ 2003-09-26 18:25 UTC (permalink / raw)


> > I think we just need a programming font that has half-sized underscores
  If you want to get into fonts etc, look at "Human Factors and Typography
for More Readable Programs", (c) 1990 ACM Press, ISBN 0-201-10745-7
(It doesn't appear to address naming questions, however.)



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 17:12     ` Matt Gregory
  2003-09-26 18:25       ` tmoran
@ 2003-09-26 18:41       ` Michael Feathers
  1 sibling, 0 replies; 52+ messages in thread
From: Michael Feathers @ 2003-09-26 18:41 UTC (permalink / raw)



"Matt Gregory" <bleah-no-more-spam@earthlink.net> wrote in message
news:Ar_cb.6981$pP6.2822@newsread2.news.atl.earthlink.net...
> I wrote:
>
> > I think we just need a programming font that has half-sized underscores
> > in front of all the capital letters.  That would solve all these
problems.
>
> Nevermind, that was a terrible idea.  It was almost good though.


Let's see, what if an IDE had a toggle which converted identifier names back
and forth on demand, flagging any clashes.  ;-)





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 18:02     ` Mike Smith
@ 2003-09-26 19:05       ` Hyman Rosen
  2003-09-26 19:56       ` Default User
  1 sibling, 0 replies; 52+ messages in thread
From: Hyman Rosen @ 2003-09-26 19:05 UTC (permalink / raw)


Mike Smith wrote:
> Yes, it's possible to take it *too* far.  But I *was* able to read the 
> quoted text at maybe half the speed at which I could have read it if it 
> were spelled correctly.  And the text in Randy King's post is even more 
> readable than that - I can read it at almost full speed.

Which clearly means that the first/last letter thing isn't the
only factor in comprehension.




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 18:02     ` Mike Smith
  2003-09-26 19:05       ` Hyman Rosen
@ 2003-09-26 19:56       ` Default User
  1 sibling, 0 replies; 52+ messages in thread
From: Default User @ 2003-09-26 19:56 UTC (permalink / raw)


Mike Smith wrote:
> 
> Hyman Rosen wrote:
> 
> > Randy King wrote:
> >
> >> Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer
> >> inwaht orredr the ltteers in a wrod are, the olny iprmoetnt tihng is
> >> taht the frist and lsat ltteer be at the rghit pclae. The rset can be a
> >> total mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae
> >> the huamn mnid deos not raed ervey lteter by istlef, butthe wrod as a
> >> wlohe. Aolbsulty amzanig huh?
> >
> >
> >     "Anidroccg to crad cniyrrag lcitsiugnis planoissefors at an uemannd,
> >      utisreviny in Bsitirh Cibmuloa, and crartnoy to the duoibus cmials
> >      of the ueticnd rcraeseh, a slpmie, macinahcel ioisrevnn of ianretnl
> >      cretcarahs araepps sneiciffut to csufnoe the eadyrevy oekoolnr."
> 
> Yes, it's possible to take it *too* far.  But I *was* able to read the
> quoted text at maybe half the speed at which I could have read it if it
> were spelled correctly.  And the text in Randy King's post is even more
> readable than that - I can read it at almost full speed.


That's because it's not well scrambled at all. Examine the larger words,
they almost all have large unchanged or barely changed segments. Most of
the time double letter combos are kept together, very little reversal of
segments. I think the given example (I've received it many times) does
not provide much evidence for the contention at all.



Brian Rodenborn



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 17:24 ` Jack Klein
  2003-09-26 17:44   ` Programmer Dude
@ 2003-09-26 19:57   ` Default User
  2003-09-27 16:35   ` Richard Heathfield
  2003-09-28 10:17   ` James Dow Allen
  3 siblings, 0 replies; 52+ messages in thread
From: Default User @ 2003-09-26 19:57 UTC (permalink / raw)


Jack Klein wrote:

> Function names must be CamelMode, but optionally underscores are
> allowed, e.g. Camel_Mode.


We are allowed underscores when acronyms appear in the name.

InitiateFMS_Executive();



Brian Rodenborn



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 15:40   ` Frank J. Lhota
@ 2003-09-27 11:18     ` Mad Hamish
  2003-09-28  9:26       ` Martin Dowie
  2003-09-29 17:34     ` Georg Bauhaus
  1 sibling, 1 reply; 52+ messages in thread
From: Mad Hamish @ 2003-09-27 11:18 UTC (permalink / raw)


On Fri, 26 Sep 2003 15:40:00 GMT, "Frank J. Lhota"
<NOSPAM.lhota.adarose@verizon.net> wrote:

>Underscores are basically a way to provide spaces in an identifier. Since
>identifiers are generally phrases (nown phrases for objects, verb phrases
>for procedures) and phrases often consist of more than one word, I find the
>use of underscores to be quite natural.
>
>The opposing argument is that underscores are too large, and that a case
>change is a more readable way to indicate how to divide the decomposition
>into words. To me, the upper / lower case method of delineate the words in
>an indentifier has always looked like the transcript of a very fast talker.
>Yes, you can make out the words, but just barely. Moreover, the use of
>letter case to delineate words prohibits any other use of letter case. It
>rules out using all caps for a certain category of identifiers, for example.
>
>There is an easy way to test which convention is more readable. Here is one
>of Shakespeare's sonnets rendered in the mixed case format:
>
>    FromFairestCreaturesWeDesireIncrease,
>    ThatTherebyBeautysRoseMightNeverDie,
>    ButAsTheRiperShouldByTimeDecease,
>    HisTenderHeirMightBearHisMemory:
>    ButThouContractedToThineOwnBrightEyes,
>    FeedstThyLightsFlameWithSelfSubstantialFuel,
>    MakingAFamineWhereAbundanceLies,
>    ThySelfThyFoeToThySweetSelfTooCruel:
>    ThouThatArtNowTheWorldsFreshOrnament,
>    AndOnlyHeraldToTheGaudySpring,
>    WithinThineOwnBudBuriestThyContent,
>    AndTenderChurlMakstWasteInNiggarding:
>    PityTheWorldOrElseThisGluttonBe,
>    ToEatTheWorldsDueByTheGraveAndThee
>
>It may be a matter of taste, but I certainly found the original sonnet to be
>more readable and more beautiful.
>
But produces more compilation errors.
Hence the mixed case format must be better for programming.
-- 
"Hope is replaced by fear and dreams by survival, most of us get by."
Stuart Adamson 1958-2001

Mad Hamish
Hamish Laws
h_laws@aardvark.net.au



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 17:44   ` Programmer Dude
@ 2003-09-27 11:44     ` Gerry Quinn
  0 siblings, 0 replies; 52+ messages in thread
From: Gerry Quinn @ 2003-09-27 11:44 UTC (permalink / raw)


In article <3F747AEE.8AA623CD@Sonnack.com>, Programmer Dude <Chris@Sonnack.com> wrote:
>Jack Klein wrote:
>
>> Interestingly I see a lot of programmers who prefer CamelMode for
>> function names, yet prefer under_scores in variable names.  In every
>> single case where I have checked, the programmer has done at least
>> some coding for Windows and its Pascal, BASIC, etc., API.  And in
>> every single case they claim that is not where their style came from.
>
>I've tried just about every combination over the years.  At one
>point it was underscores in function names, not in data names.
>OOP added enough other basic types of things it got hard to have
>a style for each.  Currently, I use lower_case_with_underscores
>for local names and CamelCaseMode for functions/methods and
>for global data.

I use:

ClassName                    // need not start with C
FunctionName()
m_MemberVariable        // misc. variable
m_pPointerVariable       // common typed variable
localVariable
pLocalPointer
SOME_CONSTANT

I guess I could use underscore more if I wanted.  Don't like typing it 
much, though. 

I think what I dislike about underscores is related to what some people 
like about them: they look like spaces.  That interferes with my ability 
to break up a statement into individual identifiers.

When someone posts code with lots of underscores, I find it hard to 
read.

Gerry Quinn                                   
-- 
http://bindweed.com 
Kaleidoscopic Screensavers and Games for Windows
Download free trial versions
New screensaver: "Hypercurve"




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 17:24 ` Jack Klein
  2003-09-26 17:44   ` Programmer Dude
  2003-09-26 19:57   ` Default User
@ 2003-09-27 16:35   ` Richard Heathfield
  2003-09-28  0:23     ` Ian Woods
  2003-09-28 10:17   ` James Dow Allen
  3 siblings, 1 reply; 52+ messages in thread
From: Richard Heathfield @ 2003-09-27 16:35 UTC (permalink / raw)


[Uncomfortable with crosspost, but not sure which groups to trim]

Jack Klein wrote:

> 
> Interestingly I see a lot of programmers who prefer CamelMode for
> function names, yet prefer under_scores in variable names.  In every
> single case where I have checked, the programmer has done at least
> some coding for Windows and its Pascal, BASIC, etc., API.  And in
> every single case they claim that is not where their style came from.
> Go figure.

Add another one to your tally. I have written a fair few Windows programs. 
But /before/ that, I had already invented MixedCase for myself. I was quite 
pleased, actually, to discover that the Windows API people had copied my 
style. :-)

-- 
Richard Heathfield : binary@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-27 16:35   ` Richard Heathfield
@ 2003-09-28  0:23     ` Ian Woods
  0 siblings, 0 replies; 52+ messages in thread
From: Ian Woods @ 2003-09-28  0:23 UTC (permalink / raw)


Richard Heathfield <dontmail@address.co.uk.invalid> wrote in
news:bl4e95$re2$2@hercules.btinternet.com: 

> [Uncomfortable with crosspost, but not sure which groups to trim]
> 
> Jack Klein wrote:
> 
>> 
>> Interestingly I see a lot of programmers who prefer CamelMode for
>> function names, yet prefer under_scores in variable names.  In every
>> single case where I have checked, the programmer has done at least
>> some coding for Windows and its Pascal, BASIC, etc., API.  And in
>> every single case they claim that is not where their style came from.
>> Go figure.
> 
> Add another one to your tally. I have written a fair few Windows
> programs. But /before/ that, I had already invented MixedCase for
> myself. I was quite pleased, actually, to discover that the Windows
> API people had copied my style. :-)

Indeed! It's not exactly a huge leap of imagination to go from

somename

to realise that

someName

or

SomeName

is generally easier to spot.

I'm just wondering when someone will pull out a patent on such an obvious 
thing.

Ian Woods



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-27 11:18     ` Mad Hamish
@ 2003-09-28  9:26       ` Martin Dowie
  0 siblings, 0 replies; 52+ messages in thread
From: Martin Dowie @ 2003-09-28  9:26 UTC (permalink / raw)


"Mad Hamish" <h_laws@aardvark.net.au> wrote in message
news:l3nanv42t229aao9a7thiorbia9ip23j8d@4ax.com...
> >It may be a matter of taste, but I certainly found the original sonnet to
be
> >more readable and more beautiful.
> >
> But produces more compilation errors.
> Hence the mixed case format must be better for programming.

Are you arguing that more compilation errors are a godd thing or a bad
thing?...


> "Hope is replaced by fear and dreams by survival, most of us get by."
> Stuart Adamson 1958-2001

"Nice quote" says Dunfermline resident.





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 17:24 ` Jack Klein
                     ` (2 preceding siblings ...)
  2003-09-27 16:35   ` Richard Heathfield
@ 2003-09-28 10:17   ` James Dow Allen
  2003-10-04  8:45     ` Matt Gregory
                       ` (2 more replies)
  3 siblings, 3 replies; 52+ messages in thread
From: James Dow Allen @ 2003-09-28 10:17 UTC (permalink / raw)


> On 25 Sep 2003 21:32:40 -0700, andy.glew@amd.com (Andy Glew) wrote in
> comp.lang.c++:

> > Specifically, are names formed with
> > underscores more or less readable
> > than names formed with MixedCase
> > StudlyCaps camelCase?

In the discussion I haven't yet seen the *correct* answer.  :-)

CamelMode, camel_mode, etc. are all quite *readable*; when using long
names the important thing is to make them *writable*, i.e.
easy to remember.

Consistency is therefore the important thing.  If you abbreviate words,
abbreviate them as the first 4 (or whatever) letters, consistently.

(I usually rewind a file with "lseek(fd, 0L, 0)" because I can't
remember if 0 is SEEKSET or SEEK_SET.)

James



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26 15:40   ` Frank J. Lhota
  2003-09-27 11:18     ` Mad Hamish
@ 2003-09-29 17:34     ` Georg Bauhaus
  2003-09-29 23:19       ` Mike Bandor
  2003-10-10 11:52       ` Stephen Baynes.
  1 sibling, 2 replies; 52+ messages in thread
From: Georg Bauhaus @ 2003-09-29 17:34 UTC (permalink / raw)


>>>>> "Frank" == Frank J Lhota <NOSPAM.lhota.adarose@verizon.net> writes:

: Since identifiers are generally phrases (nown phrases
: for objects, verb phrases for procedures) and phrases often consist
: of more than one word, I find the use of underscores to be quite
: natural.

But we should, I think, consider non-phrases or almost-non-phrases
being used as identifiers, and "juxtapositions" of identifiers.  The
isolated identifiers might be shorter and thus more easily broken
into parts during the "reading process".

  theFools(42);

  the_fools (42);

  the_Fools(42);

  The_Fools (42);
 
...

  y := doYouMind.ifI();

  y := do_you_mind.if_i ();

  y := do_You_Mind.if_I();

  y := Do_You_Mind.If_I ();


  takeAction(doYouMind.ifI(openTheWindow));

  take_action (do_you_mind.if_i (open_the_window));

  take_Action (do_You_Mind.if_I(open_The_Window));

  Take_Action (Do_You_Mind.If_I (Open_The_Window));

So in context, your "Shakespearean" argument might still apply,
even if short identifiers are readable in dense mixed case?

: There is an easy way to test which convention is more readable. Here
: is one of Shakespeare's sonnets rendered in the mixed case format:

:     FromFairestCreaturesWeDesireIncrease,


Also, looking closely at letters, fonts certainly do matter.
In a string such as "glubf()" it might or might not be easy
to distinguish the two characters 'f' and '('. It depends on
how ink would be spread, or on how pixels would appear on some
display screen. You can see this comparing foo(a) and oof(a),
using different fonts for the letters and symbols.

Georg



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-29 17:34     ` Georg Bauhaus
@ 2003-09-29 23:19       ` Mike Bandor
  2003-10-10 11:52       ` Stephen Baynes.
  1 sibling, 0 replies; 52+ messages in thread
From: Mike Bandor @ 2003-09-29 23:19 UTC (permalink / raw)


I was once told by a TRW employee that on one particular project they had a
coding standard that used underscores in lieu of running the names together.
One of their "measures" of readability was to take copy of the code, remove
the underscores, and run it through a spell checker.  If it made it through
the spell checker, it was deemed "readable".


-- 
Mike Bandor, Software Engineer, BS-CS/SE
Ada83, Ada95, C++, Delphi, JavaScript, WinHelp, PL/SQL, SQL, JOVIAL, MASM,
Java, HTML
Creator of MEGATERMS, Military Terms & Acronyms
http://home.satx.rr.com/bandor/megaterm/megaterm.htm

"Georg Bauhaus" <georg@strudel.futureapps.de> wrote in message
news:863cefjy6l.fsf@strudel.futureapps.de...
> >>>>> "Frank" == Frank J Lhota <NOSPAM.lhota.adarose@verizon.net> writes:
>
> : Since identifiers are generally phrases (nown phrases
> : for objects, verb phrases for procedures) and phrases often consist
> : of more than one word, I find the use of underscores to be quite
> : natural.
>
> But we should, I think, consider non-phrases or almost-non-phrases
> being used as identifiers, and "juxtapositions" of identifiers.  The
> isolated identifiers might be shorter and thus more easily broken
> into parts during the "reading process".
>
>   theFools(42);
>
>   the_fools (42);
>
>   the_Fools(42);
>
>   The_Fools (42);
>
> ...
>
>   y := doYouMind.ifI();
>
>   y := do_you_mind.if_i ();
>
>   y := do_You_Mind.if_I();
>
>   y := Do_You_Mind.If_I ();
>
>
>   takeAction(doYouMind.ifI(openTheWindow));
>
>   take_action (do_you_mind.if_i (open_the_window));
>
>   take_Action (do_You_Mind.if_I(open_The_Window));
>
>   Take_Action (Do_You_Mind.If_I (Open_The_Window));
>
> So in context, your "Shakespearean" argument might still apply,
> even if short identifiers are readable in dense mixed case?
>
> : There is an easy way to test which convention is more readable. Here
> : is one of Shakespeare's sonnets rendered in the mixed case format:
>
> :     FromFairestCreaturesWeDesireIncrease,
>
>
> Also, looking closely at letters, fonts certainly do matter.
> In a string such as "glubf()" it might or might not be easy
> to distinguish the two characters 'f' and '('. It depends on
> how ink would be spread, or on how pixels would appear on some
> display screen. You can see this comparing foo(a) and oof(a),
> using different fonts for the letters and symbols.
>
> Georg





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 Andy Glew
                   ` (4 preceding siblings ...)
  2003-09-26 17:24 ` Jack Klein
@ 2003-10-02  4:20 ` Peter Ammon
  2003-10-02 14:35   ` Programmer Dude
  2003-10-08 15:07 ` Isaac Gouy
  6 siblings, 1 reply; 52+ messages in thread
From: Peter Ammon @ 2003-10-02  4:20 UTC (permalink / raw)


Andy Glew wrote:
> I am in search of any rigourous,
> scientific, academic or industrial studies
> comparing naming conventions in
> C++ or similar languages such as
> Ada:
> 
> Specifically, are names formed with
> underscores more or less readable
> than names formed with MixedCase
> StudlyCaps camelCase?

[...]

Since camelCase and MixedCase seem to be getting routed by underscore 
proponents, here's one example of where something in mixed case is 
significantly more readable.  It's an excerpt from a bison grammar file 
I'm working on.

classmethod :
access_specifier method_type_specifier method_return_type_specifier 
method_declaration method_body

In the body, I reference things like $4, which (for those who don't 
know) refers to the fourth symbol in that space delimited list above. 
Can you quickly count which is the fourth?  I can't, since spaces look 
similar to underscores.

Compare to

classmethod :
accessSpecifier methodTypeSpecifier methodReturnTypeSpecifier 
methodDeclaration methodBody

The second is much more readable IMO.  The effect is even more dramatic 
without Usenet's line wrapping.

-Peter




^ permalink raw reply	[flat|nested] 52+ messages in thread

* RE: ISO Studies of underscores vs MixedCase in Ada or C++
@ 2003-10-02  9:36 Lionel.DRAGHI
  2003-10-02 11:37 ` Peter Hermann
  0 siblings, 1 reply; 52+ messages in thread
From: Lionel.DRAGHI @ 2003-10-02  9:36 UTC (permalink / raw)
  To: peter_ammon, comp.lang.ada



| -----Message d'origine-----
| De: Peter Ammon [mailto:peter_ammon@rocketmail.com]
...
| 
| classmethod :
| access_specifier method_type_specifier method_return_type_specifier 
| method_declaration method_body
| 
...
| 
| classmethod :
| accessSpecifier methodTypeSpecifier methodReturnTypeSpecifier 
| methodDeclaration methodBody
| 
| The second is much more readable IMO.  The effect is even 
| more dramatic 
| without Usenet's line wrapping.
| 
Clearly, because your point is just related to line wrapping. 

methodReturnTypeSpecifier
is less readable than 
method_Return_Type_Specifier,
and groupping less readable identifiers won't produce a more readable line.

Would you envision to suppress spaces in a book just to get all sentences
fitting on a single line? 

-- 
Lionel Draghi              http://swpat.ffii.org/index.fr.html



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-02  9:36 ISO Studies of underscores vs MixedCase in Ada or C++ Lionel.DRAGHI
@ 2003-10-02 11:37 ` Peter Hermann
  0 siblings, 0 replies; 52+ messages in thread
From: Peter Hermann @ 2003-10-02 11:37 UTC (permalink / raw)


Lionel.DRAGHI@fr.thalesgroup.com wrote:
> methodReturnTypeSpecifier
> is less readable than 
> method_Return_Type_Specifier,

progression (-:
I favor non_case_sensitivity in ALL aspects due to many good reasons.

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-02  4:20 ` Peter Ammon
@ 2003-10-02 14:35   ` Programmer Dude
  2003-10-03 22:42     ` Peter Ammon
  0 siblings, 1 reply; 52+ messages in thread
From: Programmer Dude @ 2003-10-02 14:35 UTC (permalink / raw)


Peter Ammon wrote:

> classmethod :
> access_specifier method_type_specifier method_return_type_specifier
> method_declaration method_body
> 
> Can you quickly count which is the fourth?
> Compare to
> 
> classmethod :
> accessSpecifier methodTypeSpecifier methodReturnTypeSpecifier
> methodDeclaration methodBody

Compare to

classmethod :
        access_specifier
        method_type_specifier
        method_return_type_specifier
        method_declaration
        method_body

Or my preference if the tool allows

classmethod :
        access-specifier
        method-type-specifier
        method-return-type-specifier
        method-declaration
        method-body

(In proportional fonts, hyphens are usually skinnier than
underscores and (to my eye) make the text more readable.
It's not as noticable with monospace fonts, but I think the
lower example looks better (read: more readable :-).)

-- 
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
|_____________________________________________|_______________________|



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-02 14:35   ` Programmer Dude
@ 2003-10-03 22:42     ` Peter Ammon
  2003-10-04  0:10       ` Wes Groleau
                         ` (4 more replies)
  0 siblings, 5 replies; 52+ messages in thread
From: Peter Ammon @ 2003-10-03 22:42 UTC (permalink / raw)


Programmer Dude wrote:

> Peter Ammon wrote:
> 
> 
>>classmethod :
>>access_specifier method_type_specifier method_return_type_specifier
>>method_declaration method_body
>>
>>Can you quickly count which is the fourth?
>>Compare to
>>
>>classmethod :
>>accessSpecifier methodTypeSpecifier methodReturnTypeSpecifier
>>methodDeclaration methodBody
> 
> 
> Compare to
> 
> classmethod :
>         access_specifier
>         method_type_specifier
>         method_return_type_specifier
>         method_declaration
>         method_body

You've piqued my interest, since I'm the first to admit that my grammar 
specifications are hard to read.

Where do you put the action in the above code?

classmethod :
	access_specifier
	method_type_specifier
	method_return_type_specifier
	method_declaration
	method_body
	{ doSomething(); }

What if there's more than one reduction possible?

classmethod :
	access_specifier
	method_type_specifier
	method_return_type_specifier
	method_declaration
	method_body
         { doSomething(); }
      |  something_else
	another_thing
	even_more
	blah_blah
	{ doSomethingElse(); }

This looks like it's getting hard to read.

> 
> Or my preference if the tool allows
> 
> classmethod :
>         access-specifier
>         method-type-specifier
>         method-return-type-specifier
>         method-declaration
>         method-body
> 
> (In proportional fonts, hyphens are usually skinnier than
> underscores and (to my eye) make the text more readable.
> It's not as noticable with monospace fonts, but I think the
> lower example looks better (read: more readable :-).)

Agreed!  I wish that more languages allowed hyphen use in identifiers. 
Dylan is the only one I can think of off the top of my head.

-Peter




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-03 22:42     ` Peter Ammon
@ 2003-10-04  0:10       ` Wes Groleau
  2003-10-04  1:03         ` Peter Ammon
  2003-10-04  8:48       ` Matt Gregory
                         ` (3 subsequent siblings)
  4 siblings, 1 reply; 52+ messages in thread
From: Wes Groleau @ 2003-10-04  0:10 UTC (permalink / raw)


Peter Ammon wrote:
> Agreed!  I wish that more languages allowed hyphen use in identifiers. 
> Dylan is the only one I can think of off the top of my head.

Does Dylan prevent having variables named Max,
Max-Iterations, & Iterations in the same scope?

-- 
Wes Groleau
    "Lewis's case for the existence of God contains fallacies."
"You mean like circular reasoning?"
    "He believes in God.  Isn't that illogical enough?"




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-04  0:10       ` Wes Groleau
@ 2003-10-04  1:03         ` Peter Ammon
  0 siblings, 0 replies; 52+ messages in thread
From: Peter Ammon @ 2003-10-04  1:03 UTC (permalink / raw)


Wes Groleau wrote:

> Peter Ammon wrote:
> 
>> Agreed!  I wish that more languages allowed hyphen use in identifiers. 
>> Dylan is the only one I can think of off the top of my head.
> 
> 
> Does Dylan prevent having variables named Max,
> Max-Iterations, & Iterations in the same scope?
> 

No.  Whitespace is more important in Dylan than in a language like C.

Max-Iterations <-- variable name
Max - Iterations <-- Max minus Iterations

Other strange characters can appear in Dylan variable names.  This 
allows for some nice naming conventions without the nastiness of 
something like Hungarian Notation.  See 
http://www.gwydiondylan.org/gdref/tutorial/naming-conventions.html

-Peter




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-28 10:17   ` James Dow Allen
@ 2003-10-04  8:45     ` Matt Gregory
  2003-10-04 18:41     ` Default User
  2003-10-20  7:40     ` Jacob Sparre Andersen
  2 siblings, 0 replies; 52+ messages in thread
From: Matt Gregory @ 2003-10-04  8:45 UTC (permalink / raw)


James Dow Allen wrote:

> (I usually rewind a file with "lseek(fd, 0L, 0)" because I can't
> remember if 0 is SEEKSET or SEEK_SET.)

The Vim editor is cool for things like this because you can add your
own words to the syntax highlighting.  I write Windows programs and
I have over a hundred typedef's and constants in my word list.
Actually, Vim's C syntax file comes with the standard C constants
and typedef's highlighted.




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-03 22:42     ` Peter Ammon
  2003-10-04  0:10       ` Wes Groleau
@ 2003-10-04  8:48       ` Matt Gregory
  2003-10-04 10:19         ` Martin Dowie
  2003-10-04 12:28         ` CBFalconer
  2003-10-06  6:02       ` Dave Thompson
                         ` (2 subsequent siblings)
  4 siblings, 2 replies; 52+ messages in thread
From: Matt Gregory @ 2003-10-04  8:48 UTC (permalink / raw)


Peter Ammon wrote:

> Programmer Dude wrote:
> 
>> Or my preference if the tool allows
>>
>> classmethod :
>>         access-specifier
>>         method-type-specifier
>>         method-return-type-specifier
>>         method-declaration
>>         method-body
>>
>> (In proportional fonts, hyphens are usually skinnier than
>> underscores and (to my eye) make the text more readable.
>> It's not as noticable with monospace fonts, but I think the
>> lower example looks better (read: more readable :-).)
> 
> 
> Agreed!  I wish that more languages allowed hyphen use in identifiers. 
> Dylan is the only one I can think of off the top of my head.

Lisp and Scheme.




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-04  8:48       ` Matt Gregory
@ 2003-10-04 10:19         ` Martin Dowie
  2003-10-04 12:13           ` Corey Murtagh
  2003-10-04 13:29           ` Georg Bauhaus
  2003-10-04 12:28         ` CBFalconer
  1 sibling, 2 replies; 52+ messages in thread
From: Martin Dowie @ 2003-10-04 10:19 UTC (permalink / raw)


"Matt Gregory" <bleah-no-more-spam@earthlink.net> wrote in message
news:BPvfb.20445
> > Agreed!  I wish that more languages allowed hyphen use in identifiers.
> > Dylan is the only one I can think of off the top of my head.
>
> Lisp and Scheme.

COBOL





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-04 10:19         ` Martin Dowie
@ 2003-10-04 12:13           ` Corey Murtagh
  2003-10-04 13:29           ` Georg Bauhaus
  1 sibling, 0 replies; 52+ messages in thread
From: Corey Murtagh @ 2003-10-04 12:13 UTC (permalink / raw)


Martin Dowie wrote:

> "Matt Gregory" <bleah-no-more-spam@earthlink.net> wrote in message
> news:BPvfb.20445
> 
>>>Agreed!  I wish that more languages allowed hyphen use in identifiers.
>>>Dylan is the only one I can think of off the top of my head.
>>
>>Lisp and Scheme.
> 
> COBOL

Isn't there a variation of Godwin's Law covering COBOL? :>

-- 
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur!"




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-04  8:48       ` Matt Gregory
  2003-10-04 10:19         ` Martin Dowie
@ 2003-10-04 12:28         ` CBFalconer
  1 sibling, 0 replies; 52+ messages in thread
From: CBFalconer @ 2003-10-04 12:28 UTC (permalink / raw)


Matt Gregory wrote:
> Peter Ammon wrote:
> > Programmer Dude wrote:
> >
... snip ...
> >>
> >> (In proportional fonts, hyphens are usually skinnier than
> >> underscores and (to my eye) make the text more readable.
> >> It's not as noticable with monospace fonts, but I think the
> >> lower example looks better (read: more readable :-).)
> >
> > Agreed!  I wish that more languages allowed hyphen use in identifiers.
> > Dylan is the only one I can think of off the top of my head.
> 
> Lisp and Scheme.

Cobol

-- 
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-04 10:19         ` Martin Dowie
  2003-10-04 12:13           ` Corey Murtagh
@ 2003-10-04 13:29           ` Georg Bauhaus
  2003-10-04 22:15             ` John W. Krahn
  1 sibling, 1 reply; 52+ messages in thread
From: Georg Bauhaus @ 2003-10-04 13:29 UTC (permalink / raw)


>>>>> "Martin" == Martin Dowie <martin.dowie@btopenworld.com> writes:

: "Matt Gregory" <bleah-no-more-spam@earthlink.net> wrote in message
: news:BPvfb.20445
:: > Agreed!  I wish that more languages allowed hyphen use in
:: identifiers.  > Dylan is the only one I can think of off the top of
:: my head.
:: 
:: Lisp and Scheme.

: COBOL

Also a few languages, like SNOBOL4, that allow you to have
any string as a variable name,

	$'The Shoemaker - page 3' = 'Once upon a time'

ML allows minus {minus} as identifiers, and also ":->" and the like,
though not ":-)".


Georg



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-28 10:17   ` James Dow Allen
  2003-10-04  8:45     ` Matt Gregory
@ 2003-10-04 18:41     ` Default User
  2003-10-04 22:13       ` Frank J. Lhota
  2003-10-20  7:40     ` Jacob Sparre Andersen
  2 siblings, 1 reply; 52+ messages in thread
From: Default User @ 2003-10-04 18:41 UTC (permalink / raw)


James Dow Allen wrote:
 
> (I usually rewind a file with "lseek(fd, 0L, 0)" because I can't
> remember if 0 is SEEKSET or SEEK_SET.)


The best choice for rewinding a stdio file stream is rewind().




Brian Rodenborn



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-04 18:41     ` Default User
@ 2003-10-04 22:13       ` Frank J. Lhota
  0 siblings, 0 replies; 52+ messages in thread
From: Frank J. Lhota @ 2003-10-04 22:13 UTC (permalink / raw)


"Default User" <first.last@company.com> wrote in message
news:3F7F143E.CC680533@company.com...
> The best choice for rewinding a stdio file stream is rewind().

Nah, rewind() makes me think of tapes, and that makes me feel old.





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-04 13:29           ` Georg Bauhaus
@ 2003-10-04 22:15             ` John W. Krahn
  0 siblings, 0 replies; 52+ messages in thread
From: John W. Krahn @ 2003-10-04 22:15 UTC (permalink / raw)


Georg Bauhaus wrote:
> 
> >>>>> "Martin" == Martin Dowie <martin.dowie@btopenworld.com> writes:
> 
> : "Matt Gregory" <bleah-no-more-spam@earthlink.net> wrote in message
> : news:BPvfb.20445
> :: > Agreed!  I wish that more languages allowed hyphen use in
> :: identifiers.  > Dylan is the only one I can think of off the top of
> :: my head.
> ::
> :: Lisp and Scheme.
> 
> : COBOL
> 
> Also a few languages, like SNOBOL4, that allow you to have
> any string as a variable name,
> 
>         $'The Shoemaker - page 3' = 'Once upon a time'

You can do the same thing in Perl:

          ${'The Shoemaker - page 3'} = 'Once upon a time';

And since perl interpolates in double quoted strings you can include any
8 bit value:

          ${"\xFF\0\t\cV"} = 'Once upon a time';


John
-- 
use Perl;
program
fulfillment



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-03 22:42     ` Peter Ammon
  2003-10-04  0:10       ` Wes Groleau
  2003-10-04  8:48       ` Matt Gregory
@ 2003-10-06  6:02       ` Dave Thompson
  2003-10-08 16:22       ` Programmer Dude
  2003-10-28  1:16       ` Gene Wirchenko
  4 siblings, 0 replies; 52+ messages in thread
From: Dave Thompson @ 2003-10-06  6:02 UTC (permalink / raw)


On Fri, 03 Oct 2003 15:42:20 -0700, Peter Ammon
<peter_ammon@rocketmail.com> wrote:
<snip>
> > Or my preference if the tool allows
> > 
> > classmethod :
> >         access-specifier
> >         method-type-specifier
> >         method-return-type-specifier
> >         method-declaration
> >         method-body
> > 
> > (In proportional fonts, hyphens are usually skinnier than
> > underscores and (to my eye) make the text more readable.
> > It's not as noticable with monospace fonts, but I think the
> > lower example looks better (read: more readable :-).)
> 
> Agreed!  I wish that more languages allowed hyphen use in identifiers. 
> Dylan is the only one I can think of off the top of my head.
> 
COBOL ! Only embedded, though.  My compiler accepts -X as minus X with
a warning, but I don't think that's standard.

Also the usual suspects:  FORTH allows everything but space (and
controls); and LISP everything but space, parens, period, quote,
backquote, and undoubled slash, if I haven't forgotten anything.  

- David.Thompson1 at worldnet.att.net



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 Andy Glew
                   ` (5 preceding siblings ...)
  2003-10-02  4:20 ` Peter Ammon
@ 2003-10-08 15:07 ` Isaac Gouy
  6 siblings, 0 replies; 52+ messages in thread
From: Isaac Gouy @ 2003-10-08 15:07 UTC (permalink / raw)


andy.glew@amd.com (Andy Glew) wrote in message news:<2cfd1a4e.0309252032.3e3c0a1a@posting.google.com>...
> I am in search of any rigourous,
> scientific, academic or industrial studies
> comparing naming conventions in
> C++ or similar languages such as
> Ada:

- SNIP -

> I hope it is obvious why I have chosen these
> newsgroups to post this search to:
> 
> comp.software-eng, comp.programming, 
>    - an issue of software engineering
> comp.lang.c++, 
>    - the language I am most interested in
> comp.lang.ada
>    - because I vaguely recall historical work

Maybe the "Psychology of Programming Interest Group" mailing list
would be a good place to ask?
http://www.ppig.org/lists.html



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-03 22:42     ` Peter Ammon
                         ` (2 preceding siblings ...)
  2003-10-06  6:02       ` Dave Thompson
@ 2003-10-08 16:22       ` Programmer Dude
  2003-10-28  1:16       ` Gene Wirchenko
  4 siblings, 0 replies; 52+ messages in thread
From: Programmer Dude @ 2003-10-08 16:22 UTC (permalink / raw)


Peter Ammon wrote:

>> classmethod :
>>         access_specifier
>>         method_type_specifier
>>         method_return_type_specifier
>>         method_declaration
>>         method_body
> 
> You've piqued my interest, since I'm the first to admit that my
> grammar specifications are hard to read.
> 
> Where do you put the action in the above code?
> 
> classmethod :
>         access_specifier
>         method_type_specifier
>         method_return_type_specifier
>         method_declaration
>         method_body
>         { doSomething(); }

I thought this was a grammar definition?  I'd have thought that

	method_body :== { doSomething(); }

But if they are different, the way you did it seems fine to me.

> What if there's more than one reduction possible?
> 
> classmethod :
>         access_specifier
>         method_type_specifier
>         method_return_type_specifier
>         method_declaration
>         method_body
>          { doSomething(); }
>       |  something_else
>         another_thing
>         even_more
>         blah_blah
>         { doSomethingElse(); }

Probably break them up in some fashion:

class-method:
	class-method-normal |
	class-method-extended

class-method-normal:
	access-specifier
	method-type-specifier
	method-return-type-specifier
	method-declaration
	method-body
	
class-method-extended:
	something-else
	another-thing
	even-more
	blah-blah


>> (In proportional fonts, hyphens are usually skinnier than
>> underscores and (to my eye) make the text more readable.
>> It's not as noticable with monospace fonts, but I think the
>> lower example looks better (read: more readable :-).)
> 
> Agreed!  I wish that more languages allowed hyphen use in
> identifiers. Dylan is the only one I can think of off the
> top of my head.

Others have already mentioned Lisp, so I don't have to!
(Well,... *didn't* have to...  :-)

-- 
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
|_____________________________________________|_______________________|



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-29 17:34     ` Georg Bauhaus
  2003-09-29 23:19       ` Mike Bandor
@ 2003-10-10 11:52       ` Stephen Baynes.
  2003-10-13  9:32         ` Georg Bauhaus
  1 sibling, 1 reply; 52+ messages in thread
From: Stephen Baynes. @ 2003-10-10 11:52 UTC (permalink / raw)


>   takeAction(doYouMind.ifI(openTheWindow));
>
>   take_action (do_you_mind.if_i (open_the_window));
>
>   take_Action (do_You_Mind.if_I(open_The_Window));
>
>   Take_Action (Do_You_Mind.If_I (Open_The_Window));

Once you start looking at the readability whole expressions, you also need
to look at the use of spaces. The above are not consistant about if a space
is used with round brackets. [And then there is the question - is it more
readable with the space outside or inside the bracket - my preference is for
inside - so the opening bracket is with the function name rather than the
first parameter.]
Take_Action (Do_You_Mind.If_I (Open_The_Window));
Take_Action(Do_You_Mind.If_I(Open_The_Window));
Take_Action( Do_You_Mind.If_I( Open_The_Window ) );

To go back to the original question - there have been studies that showed
underscores gave the most readable results - unfortunately I have lost the
reference and I would also like to get my hands on it again.

-
Stephen Baynes       CEng MBCS
My views are my own

"Georg Bauhaus" <georg@strudel.futureapps.de> wrote in message
news:863cefjy6l.fsf@strudel.futureapps.de...





^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-10 11:52       ` Stephen Baynes.
@ 2003-10-13  9:32         ` Georg Bauhaus
  0 siblings, 0 replies; 52+ messages in thread
From: Georg Bauhaus @ 2003-10-13  9:32 UTC (permalink / raw)


In comp.lang.ada Stephen Baynes. <stephen.baynes@soton.sc.philips.com> wrote:
: Once you start looking at the readability whole expressions, you also need
: to look at the use of spaces. The above are not consistant about if a space
: is used with round brackets.

Glad someone noticed, explicitly :-) Has anybody written Algol
programs (using spaces in identifiers)?


Georg



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-28 10:17   ` James Dow Allen
  2003-10-04  8:45     ` Matt Gregory
  2003-10-04 18:41     ` Default User
@ 2003-10-20  7:40     ` Jacob Sparre Andersen
  2003-10-21  1:08       ` Wes Groleau
  2 siblings, 1 reply; 52+ messages in thread
From: Jacob Sparre Andersen @ 2003-10-20  7:40 UTC (permalink / raw)


James Dow Allen wrote:

> CamelMode, camel_mode, etc. are all quite *readable*;

It may be a matter of personal taste (haven't seen any actual studies),
but I prefer underscores between words, when I am no allowed to put
spaces there.  In Ada I follow the style guide and use both underscores
and capitalisation.

 > when using long
> names the important thing is to make them *writable*,

Try to count how often you _read_ and _write_ an identifier.  I think
you might be surprised by the difference.  Easy writing of the
identifers is not anywhere nearly as important as easy reading.

> Consistency is therefore the important thing.

It is.

 > If you abbreviate words,
> abbreviate them as the first 4 (or whatever) letters, consistently.

I prefer the suggestion from the Ada style guide (IIRC) that you don't
abbreviate words, and that you only use acronyms from a limited
project-specific list.

> (I usually rewind a file with "lseek(fd, 0L, 0)" because I can't
> remember if 0 is SEEKSET or SEEK_SET.)

Very annoying with a standard library with an inconsistent naming of
identifiers.

One more point on the topic of consistent naming of identifiers.  I find
the style with using different naming conventions for functions,
constants, variables, etc. very annoying.  I _don't_ want to have to
worry if something is a function, constant or variable.  Specially not
if it actually is an implementation dependent detail.  So _please_ use
the same naming convention for all identifiers.

Jacob
-- 
"Any, sufficiently complicated, experiment is indistinguishable from
  magic."




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-20  7:40     ` Jacob Sparre Andersen
@ 2003-10-21  1:08       ` Wes Groleau
  0 siblings, 0 replies; 52+ messages in thread
From: Wes Groleau @ 2003-10-21  1:08 UTC (permalink / raw)


Jacob Sparre Andersen wrote:

> James Dow Allen wrote:
>> abbreviate them as the first 4 (or whatever) letters, consistently.

So Bandshift should be abbreviated Band ?

Megahertz should be Mega, not MHz ?

Message should be Mess, not Msg ?

> I prefer the suggestion from the Ada style guide (IIRC) that you don't
> abbreviate words, and that you only use acronyms from a limited
> project-specific list.

And that list should be designed to include only
a limited number of items, using the abbreviation
that is already widely used in the problem domain.

(If no widely-used abbreviation exists, the item
should not be abbreviated.)

And the following practice is sad, but it does happen
in some places:

Problem:  "Abbreviation is not on the approved list."
Solution: "Change the list; we're building TODAY."

-- 
Wes Groleau

Is it an on-line compliment to call someone a Net Wit ?




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-03 22:42     ` Peter Ammon
                         ` (3 preceding siblings ...)
  2003-10-08 16:22       ` Programmer Dude
@ 2003-10-28  1:16       ` Gene Wirchenko
  2003-10-28  3:01         ` Oplec
  2003-10-28  3:29         ` Dave Vandervies
  4 siblings, 2 replies; 52+ messages in thread
From: Gene Wirchenko @ 2003-10-28  1:16 UTC (permalink / raw)


On Fri, 03 Oct 2003 15:42:20 -0700, Peter Ammon
<peter_ammon@rocketmail.com> wrote:

[snip]

>Agreed!  I wish that more languages allowed hyphen use in identifiers. 
>Dylan is the only one I can think of off the top of my head.

     COBOL does.

Sincerely,

Gene Wirchenko




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-28  1:16       ` Gene Wirchenko
@ 2003-10-28  3:01         ` Oplec
  2003-10-28  3:29         ` Dave Vandervies
  1 sibling, 0 replies; 52+ messages in thread
From: Oplec @ 2003-10-28  3:01 UTC (permalink / raw)


Gene Wirchenko wrote:

> On Fri, 03 Oct 2003 15:42:20 -0700, Peter Ammon
> <peter_ammon@rocketmail.com> wrote:
> 
> [snip]
> 
> 
>>Agreed!  I wish that more languages allowed hyphen use in identifiers. 
>>Dylan is the only one I can think of off the top of my head.
> 
> 
>      COBOL does.
> 
> Sincerely,
> 
> Gene Wirchenko
> 

Is there a link to a document on ISO Studies of underscores... ?

Thanks, Oplec.




^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-28  1:16       ` Gene Wirchenko
  2003-10-28  3:01         ` Oplec
@ 2003-10-28  3:29         ` Dave Vandervies
  1 sibling, 0 replies; 52+ messages in thread
From: Dave Vandervies @ 2003-10-28  3:29 UTC (permalink / raw)


In article <fkgrpv0r6g82d4nh68s86cpeaaa575rbs6@4ax.com>,
Gene Wirchenko  <gwirchenkoEXCEPT@CAPITALSwencomine.com> wrote:
>On Fri, 03 Oct 2003 15:42:20 -0700, Peter Ammon
><peter_ammon@rocketmail.com> wrote:
>
>[snip]
>
>>Agreed!  I wish that more languages allowed hyphen use in identifiers. 
>>Dylan is the only one I can think of off the top of my head.
>
>     COBOL does.

As does Scheme, along with (if I'm not mistaken) most or all of the
other members of the Lisp family.


dave

-- 
Dave Vandervies                       dj3vande@csclub.uwaterloo.ca
Remember we're in a language where a misbehaving human can produce
quite a few kleenex-embedded demons.
                                      --Chris Wolfe in comp.lang.c



^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2003-10-28  3:29 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-02  9:36 ISO Studies of underscores vs MixedCase in Ada or C++ Lionel.DRAGHI
2003-10-02 11:37 ` Peter Hermann
  -- strict thread matches above, loose matches on Subject: below --
2003-09-26  4:32 Andy Glew
2003-09-26  5:43 ` Attila Feher
2003-09-26  5:54 ` Jakob Bieling
2003-09-26  7:11   ` Matt Gregory
2003-09-26 17:12     ` Matt Gregory
2003-09-26 18:25       ` tmoran
2003-09-26 18:41       ` Michael Feathers
2003-09-26 13:43   ` Steve
2003-09-26  7:27 ` Ludovic Brenta
2003-09-26 15:40   ` Frank J. Lhota
2003-09-27 11:18     ` Mad Hamish
2003-09-28  9:26       ` Martin Dowie
2003-09-29 17:34     ` Georg Bauhaus
2003-09-29 23:19       ` Mike Bandor
2003-10-10 11:52       ` Stephen Baynes.
2003-10-13  9:32         ` Georg Bauhaus
2003-09-26 16:22 ` Randy King
2003-09-26 16:51   ` Hyman Rosen
2003-09-26 18:02     ` Mike Smith
2003-09-26 19:05       ` Hyman Rosen
2003-09-26 19:56       ` Default User
2003-09-26 17:24 ` Jack Klein
2003-09-26 17:44   ` Programmer Dude
2003-09-27 11:44     ` Gerry Quinn
2003-09-26 19:57   ` Default User
2003-09-27 16:35   ` Richard Heathfield
2003-09-28  0:23     ` Ian Woods
2003-09-28 10:17   ` James Dow Allen
2003-10-04  8:45     ` Matt Gregory
2003-10-04 18:41     ` Default User
2003-10-04 22:13       ` Frank J. Lhota
2003-10-20  7:40     ` Jacob Sparre Andersen
2003-10-21  1:08       ` Wes Groleau
2003-10-02  4:20 ` Peter Ammon
2003-10-02 14:35   ` Programmer Dude
2003-10-03 22:42     ` Peter Ammon
2003-10-04  0:10       ` Wes Groleau
2003-10-04  1:03         ` Peter Ammon
2003-10-04  8:48       ` Matt Gregory
2003-10-04 10:19         ` Martin Dowie
2003-10-04 12:13           ` Corey Murtagh
2003-10-04 13:29           ` Georg Bauhaus
2003-10-04 22:15             ` John W. Krahn
2003-10-04 12:28         ` CBFalconer
2003-10-06  6:02       ` Dave Thompson
2003-10-08 16:22       ` Programmer Dude
2003-10-28  1:16       ` Gene Wirchenko
2003-10-28  3:01         ` Oplec
2003-10-28  3:29         ` Dave Vandervies
2003-10-08 15:07 ` Isaac Gouy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox