473,770 Members | 6,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ISO Studies of underscores vs MixedCase in Ada or 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?

....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
Jul 19 '05
84 5950
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: "Abbreviati on 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 ?

Jul 19 '05 #81


"Jacob Sparre Andersen" <sp****@crs4.it > wrote in message
news:3F******** ******@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
"documentat ion" 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

Jul 19 '05 #82
On Fri, 03 Oct 2003 15:42:20 -0700, Peter Ammon
<pe*********@ro cketmail.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

Jul 19 '05 #83
Gene Wirchenko wrote:
On Fri, 03 Oct 2003 15:42:20 -0700, Peter Ammon
<pe*********@ro cketmail.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.

Jul 19 '05 #84
In article <fk************ *************** *****@4ax.com>,
Gene Wirchenko <gw************ **@CAPITALSwenc omine.com> wrote:
On Fri, 03 Oct 2003 15:42:20 -0700, Peter Ammon
<pe*********@r ocketmail.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 dj******@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
Jul 19 '05 #85

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1913
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.
31
2940
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...
20
4207
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...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
Oralloy
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...
0
10057
jinu1996
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...
1
10002
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,...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.