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; 80+ 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] 80+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 ISO Studies of underscores vs MixedCase in Ada or C++ Andy Glew
@ 2003-09-26  5:43 ` Attila Feher
  2003-09-26  5:54 ` Jakob Bieling
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 80+ 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] 80+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 ISO Studies of underscores vs MixedCase in Ada or C++ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 ISO Studies of underscores vs MixedCase in Ada or C++ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 ISO Studies of underscores vs MixedCase in Ada or C++ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 ISO Studies of underscores vs MixedCase in Ada or C++ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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       ` ISO Studies of underscores vs MixedCase in Ada or C++ Stephen Baynes.
  1 sibling, 2 replies; 80+ 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] 80+ 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-03 11:53         ` Spell-checking source code (Was: ISO Studies of underscores...) Leif Roar Moldskred
  2003-10-10 11:52       ` ISO Studies of underscores vs MixedCase in Ada or C++ Stephen Baynes.
  1 sibling, 1 reply; 80+ 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] 80+ messages in thread

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 ISO Studies of underscores vs MixedCase in Ada or C++ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Spell-checking source code (Was: ISO Studies of underscores...)
  2003-09-29 23:19       ` Mike Bandor
@ 2003-10-03 11:53         ` Leif Roar Moldskred
  2003-10-03 14:13           ` William
                             ` (2 more replies)
  0 siblings, 3 replies; 80+ messages in thread
From: Leif Roar Moldskred @ 2003-10-03 11:53 UTC (permalink / raw)


"Mike Bandor" <mbandor@satx.rr.com> writes:

> 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".

This touches on one of my pet annoyances with development tools today:
no way to easily spell-check your code. In my opinion, a development
environment should at the very _least_ let you easily spell-check all
the text in comments, and preferably the individual words in variable
and function names (whether the words are separated by mixed case,
hyphens or underscores.)

Unfortunately, nobody else seems to mind. *sighs* Oh well,
spell-checkers are overrated anyway.

-- 
Leif Roar Moldskred



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

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 11:53         ` Spell-checking source code (Was: ISO Studies of underscores...) Leif Roar Moldskred
@ 2003-10-03 14:13           ` William
  2003-10-03 14:20             ` William
  2003-10-04  3:07           ` Steve
  2003-10-07 18:47           ` Jacob Sparre Andersen
  2 siblings, 1 reply; 80+ messages in thread
From: William @ 2003-10-03 14:13 UTC (permalink / raw)


"Leif Roar Moldskred" <rmoldskr@online.no> wrote in message
news:86ad8i7d1d.fsf_-_@huldreheim.huldreskog.no...
>
> This touches on one of my pet annoyances with development tools today:
> no way to easily spell-check your code. In my opinion, a development
> environment should at the very _least_ let you easily spell-check all
> the text in comments, and preferably the individual words in variable
> and function names (whether the words are separated by mixed case,
> hyphens or underscores.)

I've used a few things that did have spell checking. (One had a spell
check button on certain text fields in its forms, kinda neat.) My favorite
text and source editor, Ultraedit, has a pretty good spell checker and it
can be expanded to handle reserved words. I don't think it handles
mixed case (or case at all) though. I've never used it except to check
comments or display text. -Wm






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

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 14:13           ` William
@ 2003-10-03 14:20             ` William
  2003-10-03 18:39               ` Leif Roar Moldskred
  2003-10-03 19:48               ` Jim Rogers
  0 siblings, 2 replies; 80+ messages in thread
From: William @ 2003-10-03 14:20 UTC (permalink / raw)


"William" <Reply@NewsGroup.Please> wrote in message
news:s9adnXrUZfx-H-CiRVn-gw@giganews.com...
>
> I've used a few things that did have spell checking. (One had a spell
> check button on certain text fields in its forms, kinda neat.) My favorite
> text and source editor, Ultraedit, has a pretty good spell checker and it
> can be expanded to handle reserved words. I don't think it handles
> mixed case (or case at all) though. I've never used it except to check
> comments or display text. -Wm

Talking to myself here... I occurred to me that its syntax highlighting
makes spell checking reserved words less necessary - and the syntax
highlighting can deal with case. -Wm





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

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 14:20             ` William
@ 2003-10-03 18:39               ` Leif Roar Moldskred
  2003-10-03 22:04                 ` Kevin Morenski
  2003-10-03 19:48               ` Jim Rogers
  1 sibling, 1 reply; 80+ messages in thread
From: Leif Roar Moldskred @ 2003-10-03 18:39 UTC (permalink / raw)


"William" <Reply@NewsGroup.Please> writes:

> Talking to myself here... I occurred to me that its syntax highlighting
> makes spell checking reserved words less necessary - and the syntax
> highlighting can deal with case. -Wm

What I want though, is a spell-checker that, for instance for java,
will spot the errors such as this

   // Number of misspelled words fuond so far
   int noErorsInTetx = 0;

I want to spell-check this such that I get notified both on "fuond"
for "found", "Erors" for "Errors" and "Tetx" for "Text". They are all,
after all, words in natural language, and it should be possible to
spell-check them automatically.

-- 
Leif Roar Moldskred
demanding developer



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

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 14:20             ` William
  2003-10-03 18:39               ` Leif Roar Moldskred
@ 2003-10-03 19:48               ` Jim Rogers
  2003-10-05 15:08                 ` William
  1 sibling, 1 reply; 80+ messages in thread
From: Jim Rogers @ 2003-10-03 19:48 UTC (permalink / raw)


"William" <Reply@NewsGroup.Please> wrote in message news:<udWdnVqpxL43GeCiRVn-uw@giganews.com>...
> Talking to myself here... I occurred to me that its syntax highlighting
> makes spell checking reserved words less necessary - and the syntax
> highlighting can deal with case. -Wm

Even more to the point -- any compiler should be
able to properly recognize reserved words. 
Why use another tool to check what the compiler will also check?

Jim Rogers



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

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 18:39               ` Leif Roar Moldskred
@ 2003-10-03 22:04                 ` Kevin Morenski
  2003-10-04  9:49                   ` Leif Roar Moldskred
  2003-10-06 12:58                   ` Robert Stankowic
  0 siblings, 2 replies; 80+ messages in thread
From: Kevin Morenski @ 2003-10-03 22:04 UTC (permalink / raw)


>    // Number of misspelled words fuond so far
>    int noErorsInTetx = 0;
>
> I want to spell-check this such that I get notified both on "fuond"
> for "found", "Erors" for "Errors" and "Tetx" for "Text". They are all,
> after all, words in natural language, and it should be possible to
> spell-check them automatically.

Let's say you had a variable named "tHTa," for example.  With respect to
your concept, this would be a misspelling of the word "that."  Now, a lot of
programmers--myself included--use letters to represent certain things in
variable names.  tHTa could mean "type HTa" or anything else a programmer
could think of.  How could a program possibly differentiate between
conventions in the naming of variables?

It's much simpler to check the spelling of comments...programmers have
developed so many conventions for making their lives easier; a spell checker
on variable names just adds one more problem to overcome.

kevin





^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 11:53         ` Spell-checking source code (Was: ISO Studies of underscores...) Leif Roar Moldskred
  2003-10-03 14:13           ` William
@ 2003-10-04  3:07           ` Steve
  2003-10-04  9:44             ` Leif Roar Moldskred
  2003-10-07 18:47           ` Jacob Sparre Andersen
  2 siblings, 1 reply; 80+ messages in thread
From: Steve @ 2003-10-04  3:07 UTC (permalink / raw)


If you happen to be use GNAT (GNU Ada), the compiler does do some degree of
spell checking.

gcc -c dointxor.adb
dointxor.adb:30:28: "b_valu" is undefined
dointxor.adb:30:28: possible misspelling of "b_value"
gnatmake: "dointxor.adb" compilation error

If you use the GPS for programming Ada, you'll get a little wrench icon next
to the error in the output window.  If you click on the wrench it corrects
the spelling error.

If you're really interested in having comments spell checked, the folks at
ACT (Ada Core Techologies) would probably add the feature for a fee.

Steve
(The Duck)


"Leif Roar Moldskred" <rmoldskr@online.no> wrote in message
news:86ad8i7d1d.fsf_-_@huldreheim.huldreskog.no...
[snip]
>
> This touches on one of my pet annoyances with development tools today:
> no way to easily spell-check your code. In my opinion, a development
> environment should at the very _least_ let you easily spell-check all
> the text in comments, and preferably the individual words in variable
> and function names (whether the words are separated by mixed case,
> hyphens or underscores.)
>
> Unfortunately, nobody else seems to mind. *sighs* Oh well,
> spell-checkers are overrated anyway.
>
> -- 
> Leif Roar Moldskred





^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-04  3:07           ` Steve
@ 2003-10-04  9:44             ` Leif Roar Moldskred
  2003-10-04 10:41               ` Jakob Bieling
  0 siblings, 1 reply; 80+ messages in thread
From: Leif Roar Moldskred @ 2003-10-04  9:44 UTC (permalink / raw)


"Steve" <nospam_steved94@comcast.net> writes:

> If you happen to be use GNAT (GNU Ada), the compiler does do some degree of
> spell checking.
> 
> gcc -c dointxor.adb
> dointxor.adb:30:28: "b_valu" is undefined
> dointxor.adb:30:28: possible misspelling of "b_value"
> gnatmake: "dointxor.adb" compilation error

That's not really spell-checking though - it doesn't check "b_value" to see 
if "value" is a proper word in English.

-- 
Leif Roar Moldskred



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

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 22:04                 ` Kevin Morenski
@ 2003-10-04  9:49                   ` Leif Roar Moldskred
  2003-10-05 15:16                     ` William
  2003-10-06 12:58                   ` Robert Stankowic
  1 sibling, 1 reply; 80+ messages in thread
From: Leif Roar Moldskred @ 2003-10-04  9:49 UTC (permalink / raw)


"Kevin Morenski" <km@nospam.geekcenter.net> writes:

> Let's say you had a variable named "tHTa," for example.  With respect to
> your concept, this would be a misspelling of the word "that."  Now, a lot of
> programmers--myself included--use letters to represent certain things in
> variable names.  tHTa could mean "type HTa" or anything else a programmer
> could think of.  How could a program possibly differentiate between
> conventions in the naming of variables?

In the same way that spell-checkers for ordinary text today handles names and
other words that are correct, but not in the dictionary: When detecting the
unknown word the first time, ask the user what to do with it - whether to 
correct it, accept this instance, accept all instances in this document or
add it to your private dictionary. (For a spell-checking of source-code we'd
probably also want the option "accept all instances with this case.")

This really isn't any different from the same problem in regular text,
except that your programming convention might cause a lot of unknown
words to appear. If that's a major headache, just don't spell-check.

-- 
Leif Roar Moldskred



^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-04  9:44             ` Leif Roar Moldskred
@ 2003-10-04 10:41               ` Jakob Bieling
  2003-10-04 18:29                 ` Leif Roar Moldskred
  0 siblings, 1 reply; 80+ messages in thread
From: Jakob Bieling @ 2003-10-04 10:41 UTC (permalink / raw)


"Leif Roar Moldskred" <rmoldskr@online.no> wrote in message
news:86zngh5oct.fsf@huldreheim.huldreskog.no...
> "Steve" <nospam_steved94@comcast.net> writes:
>
> > If you happen to be use GNAT (GNU Ada), the compiler does do some degree
of
> > spell checking.
> >
> > gcc -c dointxor.adb
> > dointxor.adb:30:28: "b_valu" is undefined
> > dointxor.adb:30:28: possible misspelling of "b_value"
> > gnatmake: "dointxor.adb" compilation error
>
> That's not really spell-checking though - it doesn't check "b_value" to
see
> if "value" is a proper word in English.


    But it is that kind of word-matching I would personally like to see in
more compilers (specifically C++ compilers).

    I do agree with Kevin Morenski (news:3f7df3af_2@nntp2.nac.net) that a
real spell-checker for source code is not practicable. You said that the
spell-checker would just have to ask you whether to ignore it or how else to
proceed. Have you thought about how annoying 100s or even 1000s of those
messages boxes, asking how to proceed, will be when compiling already
existing source with this spell-checker?

regards
--
jb

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





^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-04 10:41               ` Jakob Bieling
@ 2003-10-04 18:29                 ` Leif Roar Moldskred
  2003-10-04 19:06                   ` Jakob Bieling
  0 siblings, 1 reply; 80+ messages in thread
From: Leif Roar Moldskred @ 2003-10-04 18:29 UTC (permalink / raw)


"Jakob Bieling" <netsurf@gmy.net> writes:

>     But it is that kind of word-matching I would personally like to see in
> more compilers (specifically C++ compilers).
> 
>     I do agree with Kevin Morenski (news:3f7df3af_2@nntp2.nac.net) that a
> real spell-checker for source code is not practicable. You said that the
> spell-checker would just have to ask you whether to ignore it or how else to
> proceed. Have you thought about how annoying 100s or even 1000s of those
> messages boxes, asking how to proceed, will be when compiling already
> existing source with this spell-checker?

Oh, I wouldn't want it to be part of the compiler, or continiously on. Rather,
I'd just want to be able to run a command in my editor to spell-check the
source-code I'm currently working on - much like I today invoke ispell in
emacs for regular text files.

-- 
Leif Roar Moldskred



^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-04 18:29                 ` Leif Roar Moldskred
@ 2003-10-04 19:06                   ` Jakob Bieling
  2003-10-07 18:56                     ` Spell-checking source code Jacob Sparre Andersen
  0 siblings, 1 reply; 80+ messages in thread
From: Jakob Bieling @ 2003-10-04 19:06 UTC (permalink / raw)


"Leif Roar Moldskred" <rmoldskr@online.no> wrote in message
news:86r81s6elg.fsf@huldreheim.huldreskog.no...
> "Jakob Bieling" <netsurf@gmy.net> writes:
>
> >     But it is that kind of word-matching I would personally like to see
in
> > more compilers (specifically C++ compilers).
> >
> >     I do agree with Kevin Morenski (news:3f7df3af_2@nntp2.nac.net) that
a
> > real spell-checker for source code is not practicable. You said that the
> > spell-checker would just have to ask you whether to ignore it or how
else to
> > proceed. Have you thought about how annoying 100s or even 1000s of those
> > messages boxes, asking how to proceed, will be when compiling already
> > existing source with this spell-checker?
>
> Oh, I wouldn't want it to be part of the compiler, or continiously on.
Rather,
> I'd just want to be able to run a command in my editor to spell-check the
> source-code I'm currently working on - much like I today invoke ispell in
> emacs for regular text files.


    Ah, I did not consider this difference even. *g*  My point was, checking
my own identifier names for spelling errors based on natural language rules
is a bad idea. Instead, a special code-spell-checker would be great:

    a/ 'Created' identifiers are automatically added to the list of known
words (for the current compilation run only)
    b/ When an identifier is used, but not found, the spell-checker tries to
find out what I meant (like any spell-checker)
    c/ Comments are spell-checked like in any other word processor, except
that identifier names should also be considered

    So let us assume we have this (rather useless) piece of C++ code:

1 int main ()
2 {
3     char* pRok = new char;
4     *pork = 'p';
5     delete pRok;    //  do not forget t delete pRok!
6 }

    In line 3, the spell-checker should not question the identifier name and
try to tell me that I meant 'pork' (see a/ above). Instead, it should tell
me in line 4 that I most probably meant 'pRok' and not 'pork' (see b/
above). And last but not least, in line 5, the spell-checker should point
out the missing 'o' (ie. ".. forget to ..") but leave 'pRok' undiagnosed.

regards
--
jb

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





^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 19:48               ` Jim Rogers
@ 2003-10-05 15:08                 ` William
  0 siblings, 0 replies; 80+ messages in thread
From: William @ 2003-10-05 15:08 UTC (permalink / raw)


"Jim Rogers" <jimmaureenrogers@worldnet.att.net> wrote in message
news:82347202.0310031148.1284a52b@posting.google.com...
> "William" <Reply@NewsGroup.Please> wrote in message
news:<udWdnVqpxL43GeCiRVn-uw@giganews.com>...
> > Talking to myself here... I occurred to me that its syntax highlighting
> > makes spell checking reserved words less necessary - and the syntax
> > highlighting can deal with case. -Wm
>
> Even more to the point -- any compiler should be
> able to properly recognize reserved words.
> Why use another tool to check what the compiler will also check?

Until we got faster machines, one of our builds could take an hour.
No fun to have the compiler detect a mispelled word 50 minutes in.
(Sure, if everyone did an incremental test build, the problem would
be avoided, but...)  -Wm





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

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-04  9:49                   ` Leif Roar Moldskred
@ 2003-10-05 15:16                     ` William
  0 siblings, 0 replies; 80+ messages in thread
From: William @ 2003-10-05 15:16 UTC (permalink / raw)


"Leif Roar Moldskred" <rmoldskr@online.no> wrote in message
news:86vfr55o45.fsf@huldreheim.huldreskog.no...
>
> In the same way that spell-checkers for ordinary text today handles names
and
> other words that are correct, but not in the dictionary: When detecting
the
> unknown word the first time, ask the user what to do with it - whether to
> correct it, accept this instance, accept all instances in this document or
> add it to your private dictionary. (For a spell-checking of source-code
we'd
> probably also want the option "accept all instances with this case.")

Well, they will if you add the entire label to the dictionary, but none I'm
aware
of will break up words based on mixed-case. Ultraedit will break up words
on underscores - didn't know that until I just tried it I can make it ignore
mixed-case words, but not break them apart. (It does support multiple user
dictionaries, so you could have a dictionary-per-project defining all the
approved labels.) -Wm






^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code (Was: ISO Studies of underscores...)
  2003-10-03 22:04                 ` Kevin Morenski
  2003-10-04  9:49                   ` Leif Roar Moldskred
@ 2003-10-06 12:58                   ` Robert Stankowic
  1 sibling, 0 replies; 80+ messages in thread
From: Robert Stankowic @ 2003-10-06 12:58 UTC (permalink / raw)



"Kevin Morenski" <km@nospam.geekcenter.net> schrieb im Newsbeitrag
news:3f7df3af_2@nntp2.nac.net...
> >    // Number of misspelled words fuond so far
> >    int noErorsInTetx = 0;
> >
> > I want to spell-check this such that I get notified both on "fuond"
> > for "found", "Erors" for "Errors" and "Tetx" for "Text". They are all,
> > after all, words in natural language, and it should be possible to
> > spell-check them automatically.
>
> Let's say you had a variable named "tHTa," for example.  With respect to
> your concept, this would be a misspelling of the word "that."  Now, a lot
of
> programmers--myself included--use letters to represent certain things in
> variable names.  tHTa could mean "type HTa" or anything else a programmer
> could think of.  How could a program possibly differentiate between
> conventions in the naming of variables?
>
> It's much simpler to check the spelling of comments...programmers have
> developed so many conventions for making their lives easier; a spell
checker
> on variable names just adds one more problem to overcome.

An editor which is capable of finding the definition of variables and
highlighting a name already defined/declared might solve that problem. VB
has that feature to a certain degree - if you use mixed case for names of
variables, functions etc. and you type a name already declared in lowercase
the editor will automatically convert it to the form in which it is
declared. If you know, the name is declared and case does not flip you know
you made a typo. IIRC Keil development system for embedded C programming has
a similar feature.

just my $0.02
Robert





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

* Re: Spell-checking source code
  2003-10-03 11:53         ` Spell-checking source code (Was: ISO Studies of underscores...) Leif Roar Moldskred
  2003-10-03 14:13           ` William
  2003-10-04  3:07           ` Steve
@ 2003-10-07 18:47           ` Jacob Sparre Andersen
  2 siblings, 0 replies; 80+ messages in thread
From: Jacob Sparre Andersen @ 2003-10-07 18:47 UTC (permalink / raw)


Leif Roar Moldskred wrote:

> This touches on one of my pet annoyances with development tools today:
> no way to easily spell-check your code.

I just loaded a random source file into my standard IDE and did some 
spell-checking on it.  The code was written partially in French, so it 
really needed it.  :-)

Which IDE it is is revealed below.

Jacob
-- 
"Any newsgroup where software developers hang out is
  an Emacs newsgroup."




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

* Re: Spell-checking source code
  2003-10-04 19:06                   ` Jakob Bieling
@ 2003-10-07 18:56                     ` Jacob Sparre Andersen
  2003-10-12  8:07                       ` Jakob Bieling
  0 siblings, 1 reply; 80+ messages in thread
From: Jacob Sparre Andersen @ 2003-10-07 18:56 UTC (permalink / raw)


Jakob Bieling wrote:
> "Leif Roar Moldskred" <rmoldskr@online.no> wrote in message
> news:86r81s6elg.fsf@huldreheim.huldreskog.no...
> 
>>"Jakob Bieling" <netsurf@gmy.net> writes:

>     Ah, I did not consider this difference even. *g*  My point was, checking
> my own identifier names for spelling errors based on natural language rules
> is a bad idea.

Why.  They are hopefully spelled correctly.  Otherwise you are adding an 
unneeded complication to reading and understanding your code.

> Instead, a special code-spell-checker would be great:
> 
>     a/ 'Created' identifiers are automatically added to the list of known
>        words (for the current compilation run only)

I wouldn't like that.  Incorrectly spelled identifiers make code 
maintenance more difficult.

>     b/ When an identifier is used, but not found, the spell-checker tries to
>        find out what I meant (like any spell-checker)

Would certainly be nice.  But doing a proper job here basically means 
trying to compile the code.  If you decide to ignore visibility rules, 
things will of course become much simpler.

>     c/ Comments are spell-checked like in any other word processor, except
>        that identifier names should also be considered

Since I don't think misspellings should be allowed in identifier names, 
this point seems irrelevant to me.

Jacob
-- 
LDraw.org Parts Tracker FAQ:
                http://www.ldraw.org/library/tracker/ref/faq/




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

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-09-26  4:32 ISO Studies of underscores vs MixedCase in Ada or C++ Andy Glew
                   ` (5 preceding siblings ...)
  2003-10-02  4:20 ` Peter Ammon
@ 2003-10-08 15:07 ` Isaac Gouy
  6 siblings, 0 replies; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code
  2003-10-07 18:56                     ` Spell-checking source code Jacob Sparre Andersen
@ 2003-10-12  8:07                       ` Jakob Bieling
  2003-10-14 13:41                         ` Jacob Sparre Andersen
  0 siblings, 1 reply; 80+ messages in thread
From: Jakob Bieling @ 2003-10-12  8:07 UTC (permalink / raw)


"Jacob Sparre Andersen" <sparre@crs4.it> wrote in message
news:3F830C63.1070005@crs4.it...
> Jakob Bieling wrote:
> > "Leif Roar Moldskred" <rmoldskr@online.no> wrote in message
> > news:86r81s6elg.fsf@huldreheim.huldreskog.no...
> >
> >>"Jakob Bieling" <netsurf@gmy.net> writes:
>
> >     Ah, I did not consider this difference even. *g*  My point was,
checking
> > my own identifier names for spelling errors based on natural language
rules
> > is a bad idea.
>
> Why.  They are hopefully spelled correctly.  Otherwise you are adding an
> unneeded complication to reading and understanding your code.
>
> > Instead, a special code-spell-checker would be great:
> >
> >     a/ 'Created' identifiers are automatically added to the list of
known
> >        words (for the current compilation run only)
>
> I wouldn't like that.  Incorrectly spelled identifiers make code
> maintenance more difficult.

    I do not know how you choose your identifier names, but I usually give
them abbreviated prefixes, which would make every spell-checker flag a
misspelling. See Kevin's example (news:3f7df3af_2@nntp2.nac.net)

> >     b/ When an identifier is used, but not found, the spell-checker
tries to
> >        find out what I meant (like any spell-checker)
>
> Would certainly be nice.  But doing a proper job here basically means
> trying to compile the code.  If you decide to ignore visibility rules,
> things will of course become much simpler.

    Right. You got me thinking here, though. Since the code is
sort-of-spell-checked by the compiler already, point a and b are pretty much
superflous (unless you want the luxury of the compiler trying to guess the
correctly spelled identifier name). No need for a special spell-checker
anymore, except that it should only spell-check comments ;)

regards
--
jb

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





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

* Re: ISO Studies of underscores vs MixedCase in Ada or C++
  2003-10-10 11:52       ` ISO Studies of underscores vs MixedCase in Ada or C++ Stephen Baynes.
@ 2003-10-13  9:32         ` Georg Bauhaus
  0 siblings, 0 replies; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code
  2003-10-12  8:07                       ` Jakob Bieling
@ 2003-10-14 13:41                         ` Jacob Sparre Andersen
  2003-10-14 15:30                           ` Jakob Bieling
  0 siblings, 1 reply; 80+ messages in thread
From: Jacob Sparre Andersen @ 2003-10-14 13:41 UTC (permalink / raw)


Jakob Bieling wrote:
> "Jacob Sparre Andersen" <sparre@crs4.it> wrote in message
> news:3F830C63.1070005@crs4.it...

>>I wouldn't like that.  Incorrectly spelled identifiers make code
>>maintenance more difficult.
> 
>     I do not know how you choose your identifier names, but I usually give
> them abbreviated prefixes,

I practically never use abbreviations or acronyms in identifiers - 
except for those from the project specific "approved" list ("IO" is 
always there, though :).  And when I do, it is always as separate parts 
like in "Integer_Text_IO".  I would never write "IntegerTextIO", 
"intTextIO" or "Int_Text_IO" in my code.

If you want more details on how I choose my identifier names, then 
chapter 3 in �Ada Quality and Style� is hopefully a good description.

Greetings,

Jacob
-- 
There only exist 10 kinds of people: Those who know binary
numbers and those who don't know binary numbers.




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

* Re: Spell-checking source code
  2003-10-14 13:41                         ` Jacob Sparre Andersen
@ 2003-10-14 15:30                           ` Jakob Bieling
  2003-10-14 15:50                             ` Peter Bushell
                                               ` (2 more replies)
  0 siblings, 3 replies; 80+ messages in thread
From: Jakob Bieling @ 2003-10-14 15:30 UTC (permalink / raw)


"Jacob Sparre Andersen" <sparre@crs4.it> wrote in message
news:3F8BFCF5.6020906@crs4.it...

> Jakob Bieling wrote:

> > "Jacob Sparre Andersen" <sparre@crs4.it> wrote:

> > > I wouldn't like that.  Incorrectly spelled identifiers make code
> > > maintenance more difficult.

> >     I do not know how you choose your identifier names, but I usually
give
> > them abbreviated prefixes,

> I practically never use abbreviations or acronyms in identifiers -


    Not sure where I picked that habit up, but I guess it is pure laziness.
I could not imagine having to type those long names everytime you use them.
Especially counter variables in for-loops (posting from comp.lang.c++) ..
you also use simple i's and j's etc. there, right? As you seem to be posting
from comp.lang.ada, I am not too sure if Ada provides such constructs in the
same way C++ does, so maybe Ada has different means of looping in a
for-loop-kind-of-way (yes, I know pretty much nothing about Ada).

    Also, sometimes I tend to abbreviate quite a lot, so that later I might
not know what it stands for. In cases like those I just put a comment next
to where I declared the variable and I can keep saving those keystrokes.

regards
--
jb

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





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

* Re: Spell-checking source code
  2003-10-14 15:30                           ` Jakob Bieling
@ 2003-10-14 15:50                             ` Peter Bushell
  2003-10-14 16:46                               ` Jakob Bieling
       [not found]                             ` <h51pov4t28ujj3bqlareldhsiie0m4ljre@4ax.com>
  2003-10-20  7:44                             ` Jacob Sparre Andersen
  2 siblings, 1 reply; 80+ messages in thread
From: Peter Bushell @ 2003-10-14 15:50 UTC (permalink / raw)



"Jakob Bieling" <netsurf@gmy.net> wrote in message
news:bmh4q5$g9a$03$1@news.t-online.com...
> "Jacob Sparre Andersen" <sparre@crs4.it> wrote in message
> news:3F8BFCF5.6020906@crs4.it...
>
>     Also, sometimes I tend to abbreviate quite a lot, so that later I
might
> not know what it stands for. In cases like those I just put a comment next
> to where I declared the variable and I can keep saving those keystrokes.
>

If you can't remember what it meant, pity the poor engineer who has to
maintain your code when you've gone! Having to look up a declaration every
few seconds is not acceptable.

There is evidence* to suggest that 80% of programming is (or should be)
thinking time. Saving keystrokes is therefore not an issue.

Regards,

Peter Bushell.

* My source was Glass, Robert L., "Facts and Fallacies of Software
Engineering". His source was some research material published in another of
his books: "Software Creativity".





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

* Re: Spell-checking source code
  2003-10-14 15:50                             ` Peter Bushell
@ 2003-10-14 16:46                               ` Jakob Bieling
  2003-10-14 17:34                                 ` Alan Balmer
  2003-10-20  7:42                                 ` Jacob Sparre Andersen
  0 siblings, 2 replies; 80+ messages in thread
From: Jakob Bieling @ 2003-10-14 16:46 UTC (permalink / raw)


"Peter Bushell" <DELETEnewsreplyALL@software-inCAPStegrity.com> wrote:

> "Jakob Bieling" <netsurf@gmy.net> wrote:

> > "Jacob Sparre Andersen" <sparre@crs4.it> wrote:

> >     Also, sometimes I tend to abbreviate quite a lot, so that later I
> might
> > not know what it stands for. In cases like those I just put a comment
next
> > to where I declared the variable and I can keep saving those keystrokes.

> If you can't remember what it meant, pity the poor engineer who has to
> maintain your code when you've gone! Having to look up a declaration every
> few seconds is not acceptable.

    You do not have to. All declarations (loop counters etc. are an
exception) are at the beginning of the function, along with possible
comments. And for those identifiers where comments are necessary, I do not
think it is impossible to remember them.

> There is evidence* to suggest that 80% of programming is (or should be)
> thinking time. Saving keystrokes is therefore not an issue.

    True, but it is still pretty annoying to type all kinds of variable
names out (we are talking about long names, anything over 10 letters,
right?) all the time you use them. The 'burden' of remembering 5 or 6 names
for which you always see the abbreviations is less, in my opinion.

    To avoid misunderstandings, I do not approve using abbreviations for all
kinds of variables. But I do find it acceptable to use my way of
abbreviating (including comments) for function local variables.

hth
--
jb

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





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

* Re: Spell-checking source code
  2003-10-14 16:46                               ` Jakob Bieling
@ 2003-10-14 17:34                                 ` Alan Balmer
  2003-10-15  5:34                                   ` Jakob Bieling
  2003-10-20  7:42                                 ` Jacob Sparre Andersen
  1 sibling, 1 reply; 80+ messages in thread
From: Alan Balmer @ 2003-10-14 17:34 UTC (permalink / raw)


On Tue, 14 Oct 2003 18:46:59 +0200, "Jakob Bieling" <netsurf@gmy.net>
wrote:

>    True, but it is still pretty annoying to type all kinds of variable
>names out (we are talking about long names, anything over 10 letters,
>right?) all the time you use them

A good editor can eliminate that problem.

--
Al Balmer
Balmer Consulting
removebalmerconsultingthis@att.net



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

* Re: Spell-checking source code
  2003-10-14 17:34                                 ` Alan Balmer
@ 2003-10-15  5:34                                   ` Jakob Bieling
  2003-10-15 15:02                                     ` Alan Balmer
  2003-10-16  8:57                                     ` Frank Schmitt
  0 siblings, 2 replies; 80+ messages in thread
From: Jakob Bieling @ 2003-10-15  5:34 UTC (permalink / raw)


"Alan Balmer" <albalmer@att.net> wrote in message
news:hscoov4a1i762dd8jtf7ejnh6h0pg27a1e@4ax.com...
> On Tue, 14 Oct 2003 18:46:59 +0200, "Jakob Bieling" <netsurf@gmy.net>
> wrote:
>
> >    True, but it is still pretty annoying to type all kinds of variable
> >names out (we are talking about long names, anything over 10 letters,
> >right?) all the time you use them
>
> A good editor can eliminate that problem.


    For function local variables, mine does not. For class members or
identifiers in a namespace it does.

regards
--
jb

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





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

* Re: Spell-checking source code
       [not found]                             ` <h51pov4t28ujj3bqlareldhsiie0m4ljre@4ax.com>
@ 2003-10-15  5:43                               ` Jakob Bieling
  0 siblings, 0 replies; 80+ messages in thread
From: Jakob Bieling @ 2003-10-15  5:43 UTC (permalink / raw)


<brougham5@yahoo.com> wrote in message
news:h51pov4t28ujj3bqlareldhsiie0m4ljre@4ax.com...
> "Jakob Bieling" <netsurf@gmy.net> wrote:
>
> >Not sure where I picked that habit up, but I guess it is pure laziness.
> >I could not imagine having to type those long names everytime you use
them.
>
> Neither can I.  I rarely abbreviate in a variable name.  But I rely on
code
> completion in my editor to save typing those keystrokes.

    As a said in the other post: For function local variables, mine does not
have that feature.

> The problem is that once you start abbreviating, odds are some
abbreviations
> are not going to be consistent.  I've seen nbr, no, nu, or num instead of
> number.  Using an editor that will complete nu to number might make your
> life easier in a multi-person project.

    Yes, I do write 'num' instead of number. Or I also write 'msg' instead
of message, or 'ips' for an 'InterProcessSynchronisation' handle. In case of
ips, I might not know what it is without context. But when seeing that
variable used in a function call, it is clear what it is supposed to be.
Along with the comments in the code, I find it justified and not overly hard
to read.

regards
--
jb

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





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

* Re: Spell-checking source code
  2003-10-15  5:34                                   ` Jakob Bieling
@ 2003-10-15 15:02                                     ` Alan Balmer
  2003-10-16  8:57                                     ` Frank Schmitt
  1 sibling, 0 replies; 80+ messages in thread
From: Alan Balmer @ 2003-10-15 15:02 UTC (permalink / raw)


On Wed, 15 Oct 2003 07:34:33 +0200, "Jakob Bieling" <netsurf@gmy.net>
wrote:

>"Alan Balmer" <albalmer@att.net> wrote in message
>news:hscoov4a1i762dd8jtf7ejnh6h0pg27a1e@4ax.com...
>> On Tue, 14 Oct 2003 18:46:59 +0200, "Jakob Bieling" <netsurf@gmy.net>
>> wrote:
>>
>> >    True, but it is still pretty annoying to type all kinds of variable
>> >names out (we are talking about long names, anything over 10 letters,
>> >right?) all the time you use them
>>
>> A good editor can eliminate that problem.
>
>
>    For function local variables, mine does not. For class members or
>identifiers in a namespace it does.
>
Mine will complete any symbol it knows about, or give you a drop-down
list if there's more than one choice. However, almost any editor will
allow you to code with abbreviations, then expand them to full names
with search and replace. This can be useful for some people who have
total recall in the heat of a programming session, but can't remember
what they were thinking a week later :-)

--
Al Balmer
Balmer Consulting
removebalmerconsultingthis@att.net



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

* Re: Spell-checking source code
  2003-10-15  5:34                                   ` Jakob Bieling
  2003-10-15 15:02                                     ` Alan Balmer
@ 2003-10-16  8:57                                     ` Frank Schmitt
  1 sibling, 0 replies; 80+ messages in thread
From: Frank Schmitt @ 2003-10-16  8:57 UTC (permalink / raw)


"Jakob Bieling" <netsurf@gmy.net> writes:

> "Alan Balmer" <albalmer@att.net> wrote in message
> news:hscoov4a1i762dd8jtf7ejnh6h0pg27a1e@4ax.com...
> > On Tue, 14 Oct 2003 18:46:59 +0200, "Jakob Bieling" <netsurf@gmy.net>
> > wrote:
> >
> > >    True, but it is still pretty annoying to type all kinds of variable
> > >names out (we are talking about long names, anything over 10 letters,
> > >right?) all the time you use them
> >
> > A good editor can eliminate that problem.
> 
> 
>     For function local variables, mine does not. For class members or
> identifiers in a namespace it does.

But why would you want to make function local variables' names more than
10 letters long?
My local variable names tend to consist of only one word, e.g

OutputStreamWriter writer;

Or are your functions so long that you need longer variable names?

regards
frank

-- 
Frank Schmitt 
4SC AG		phone: +49 89 700763-0
		e-mail: frankNO DOT SPAMschmitt AT 4sc DOT com



^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code
  2003-10-14 16:46                               ` Jakob Bieling
  2003-10-14 17:34                                 ` Alan Balmer
@ 2003-10-20  7:42                                 ` Jacob Sparre Andersen
  1 sibling, 0 replies; 80+ messages in thread
From: Jacob Sparre Andersen @ 2003-10-20  7:42 UTC (permalink / raw)


Jakob Bieling wrote:

>     True, but it is still pretty annoying to type all kinds of variable
> names out

I suppose I should thank my mother for insisting that I learned how to
use a typewriter.

>     To avoid misunderstandings, I do not approve using abbreviations for all
> kinds of variables. But I do find it acceptable to use my way of
> abbreviating (including comments) for function local variables.

Do non-local variables really exist?  :-)

But yes, if you make sure that the declaration of the variables is
always immediately visible, when one is observing their use, then I can
understand your argument (although I still don't approve of it).

Jacob
-- 
"The current state of knowledge can be summarised thus:
  In the beginning, there was nothing, which exploded."




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

* Re: Spell-checking source code
  2003-10-14 15:30                           ` Jakob Bieling
  2003-10-14 15:50                             ` Peter Bushell
       [not found]                             ` <h51pov4t28ujj3bqlareldhsiie0m4ljre@4ax.com>
@ 2003-10-20  7:44                             ` Jacob Sparre Andersen
  2003-10-24 11:55                               ` Stephen Baynes.
  2 siblings, 1 reply; 80+ messages in thread
From: Jacob Sparre Andersen @ 2003-10-20  7:44 UTC (permalink / raw)


Jakob Bieling wrote:

[ abbreviated identifier prefixes ]

>     Not sure where I picked that habit up, but I guess it is pure laziness.
> I could not imagine having to type those long names everytime you use them.

Well.  I tend to read code more often than I write it (even my own), and
most of my time is spent thinking about what to write, so saving a few
keystrokes really doesn't make sense to me.

> Especially counter variables in for-loops (posting from comp.lang.c++) ..
> you also use simple i's and j's etc. there, right?

No.  (unless it is for matrix and tensor manipulation, where the
"documentation" actually says "i", "j" and "k")

> As you seem to be posting from comp.lang.ada,

Well.  There and "comp.software-eng".

 > I am not too sure if Ada provides such constructs in the
> same way C++ does, so maybe Ada has different means of looping in a
> for-loop-kind-of-way (yes, I know pretty much nothing about Ada).

The Ada for loop is not as flexible/error-prone as I remember the C++
for loop (which I haven't had to use for years :).  A quick example:

     for Day in Monday .. Friday loop
        Put (Day); Put_Line (" is a workday.");
     end loop;

(where I assume I have declared an enumerated type based on the days of
the week).  The counter variable is created by the for loop statement,
so you don't have to worry about making an explicit declaration of a
variable for use as the counter.  I seem to remember that you have to
have an explicit declaration of the counter variable in C++, which of
course makes a slight difference.

>     Also, sometimes I tend to abbreviate quite a lot, so that later I might
> not know what it stands for.

Not good.  That costs time and is a potential source for errors if you
misremember the meaning of the abbreviation.

 > In cases like those I just put a comment next
> to where I declared the variable and I can keep saving those keystrokes.

I consider that a misuse of comments.  I see comments as a means for
expressing what _can_ not be expressed in actual code.  Otherwise you
risk ending up with code and comments that say different things.  One
result of this view is of course that it differs from language to
language, what are reasonable comments.

My main worry with long identifier names is that they shouldn't make the
lines so long that they become incomprehensible.

Jacob
-- 
"There are only two types of data:
                           Data which has been backed up
                           Data which has not been lost - yet"




^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ messages in thread

* Re: Spell-checking source code
  2003-10-20  7:44                             ` Jacob Sparre Andersen
@ 2003-10-24 11:55                               ` Stephen Baynes.
  0 siblings, 0 replies; 80+ messages in thread
From: Stephen Baynes. @ 2003-10-24 11:55 UTC (permalink / raw)




"Jacob Sparre Andersen" <sparre@crs4.it> wrote in message
news:3F93925F.5060808@crs4.it...
> Jakob Bieling wrote:
>
> [ abbreviated identifier prefixes ]
>
> >     Not sure where I picked that habit up, but I guess it is pure
laziness.
> > I could not imagine having to type those long names everytime you use
them.
>
> Well.  I tend to read code more often than I write it (even my own), and
> most of my time is spent thinking about what to write, so saving a few
> keystrokes really doesn't make sense to me.
>
> > Especially counter variables in for-loops (posting from comp.lang.c++)
..
> > you also use simple i's and j's etc. there, right?
>
> No.  (unless it is for matrix and tensor manipulation, where the
> "documentation" actually says "i", "j" and "k")

To me the length of the name should reflect the size of the scope. A one
letter variable name is fine for the counter in a very short for loop, or a
temporary that is only used for a couple of adjacent statements. But if the
variable is used over many lines a longer more meaningful name is required.
Global variables tend to end up with the longest names as they have to be
used and understood in many more contexts.

Like all rules - there are exceptions. In particular if something is used
very frequently then a shorter name is desirable for convenience and
acceptable as it will be well known and understood. [eg 'stderr']

--
Stephen Baynes       CEng MBCS
My views are my own






^ permalink raw reply	[flat|nested] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ 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; 80+ 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] 80+ messages in thread

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

Thread overview: 80+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-26  4:32 ISO Studies of underscores vs MixedCase in Ada or C++ 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-03 11:53         ` Spell-checking source code (Was: ISO Studies of underscores...) Leif Roar Moldskred
2003-10-03 14:13           ` William
2003-10-03 14:20             ` William
2003-10-03 18:39               ` Leif Roar Moldskred
2003-10-03 22:04                 ` Kevin Morenski
2003-10-04  9:49                   ` Leif Roar Moldskred
2003-10-05 15:16                     ` William
2003-10-06 12:58                   ` Robert Stankowic
2003-10-03 19:48               ` Jim Rogers
2003-10-05 15:08                 ` William
2003-10-04  3:07           ` Steve
2003-10-04  9:44             ` Leif Roar Moldskred
2003-10-04 10:41               ` Jakob Bieling
2003-10-04 18:29                 ` Leif Roar Moldskred
2003-10-04 19:06                   ` Jakob Bieling
2003-10-07 18:56                     ` Spell-checking source code Jacob Sparre Andersen
2003-10-12  8:07                       ` Jakob Bieling
2003-10-14 13:41                         ` Jacob Sparre Andersen
2003-10-14 15:30                           ` Jakob Bieling
2003-10-14 15:50                             ` Peter Bushell
2003-10-14 16:46                               ` Jakob Bieling
2003-10-14 17:34                                 ` Alan Balmer
2003-10-15  5:34                                   ` Jakob Bieling
2003-10-15 15:02                                     ` Alan Balmer
2003-10-16  8:57                                     ` Frank Schmitt
2003-10-20  7:42                                 ` Jacob Sparre Andersen
     [not found]                             ` <h51pov4t28ujj3bqlareldhsiie0m4ljre@4ax.com>
2003-10-15  5:43                               ` Jakob Bieling
2003-10-20  7:44                             ` Jacob Sparre Andersen
2003-10-24 11:55                               ` Stephen Baynes.
2003-10-07 18:47           ` Jacob Sparre Andersen
2003-10-10 11:52       ` ISO Studies of underscores vs MixedCase in Ada or C++ 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