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.programmin g,
- an issue of software engineering
comp.lang.c++,
- the language I am most interested in
comp.lang.ada
- because I vaguely recall historical work 84 5944
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
SMTPTCPIPConnec tion. Usual solution is to write them wrong as
SmtpTcpIpConnec tion.
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
"Andy Glew" <an*******@amd. com> wrote in message
news:2c******** *************** ***@posting.goo gle.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)
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.
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.
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" <ne*****@gmy.ne t> wrote in message
news:bl******** *****@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.
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:
FromFairestCrea turesWeDesireIn crease,
ThatTherebyBeau tysRoseMightNev erDie,
ButAsTheRiperSh ouldByTimeDecea se,
HisTenderHeirMi ghtBearHisMemor y:
ButThouContract edToThineOwnBri ghtEyes,
FeedstThyLights FlameWithSelfSu bstantialFuel,
MakingAFamineWh ereAbundanceLie s,
ThySelfThyFoeTo ThySweetSelfToo Cruel:
ThouThatArtNowT heWorldsFreshOr nament,
AndOnlyHeraldTo TheGaudySpring,
WithinThineOwnB udBuriestThyCon tent,
AndTenderChurlM akstWasteInNigg arding:
PityTheWorldOrE lseThisGluttonB e,
ToEatTheWorldsD ueByTheGraveAnd Thee
It may be a matter of taste, but I certainly found the original sonnet to be
more readable and more beautiful.
<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?
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."
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Geoff Turner |
last post by:
Using VB6, I set up a menu like
&File
....&Open
....&Close
etc. In design mode, the F is underscored as expected
but O and C are not.
In run mode no underscores are displayed when selecting menu
items with the mouse.
|
by: Chris S. |
last post by:
Is there a purpose for using trailing and leading double underscores for
built-in method names? My impression was that underscores are supposed
to imply some sort of pseudo-privatization, but would using
myclass.len() instead of myclass.__len__() really cause Python
considerable harm? As much as I adore Python, I have to admit, I find
this to be one of the language's most "unPythonic" features and a key
arguing point against Python. I've...
|
by: benhoyt |
last post by:
Hi guys,
I've been using Python for some time now, and am very impressed with
its lack of red tape and its clean syntax -- both probably due to the
BDFL's ability to know when to say "no".
Most of the things that "got me" initially have been addressed in
recent versions of Python, or are being addressed in Python 3000. But
it looks like the double underscores are staying as is. This is
probably a good thing unless there are better...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |