Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

identifier nomenclature

7 views
Skip to first unread message

bob

unread,
May 16, 2012, 11:17:42 AM5/16/12
to
What are some of the most common ways to convert a set of words to an identifier?

For instance:

a_set_of_words

ASetOfWords

asetofwords

aSetOfWords

Which do you prefer and why?

Patricia Shanahan

unread,
May 16, 2012, 11:57:07 AM5/16/12
to
Some coding conventions use different forms for e.g. class identifiers
and method identifiers.

I like consistency more than I care about the exact rules, so I chose
according to the first applicable rule from the following list:

1. Consistency with existing code in the same program.

2. If the language has rich APIs, match the identifier rules used in the
APIs.

3. If there is a commonly used coding standard follow it.

4. In the rare case that none of the above apply, I usually just go with
the same rules as in the last program I worked on. I'm more likely to
remember those rules and apply them consistently than any new set of
rules I make up.

Patricia

Jacob Sparre Andersen

unread,
May 18, 2012, 4:34:42 AM5/18/12
to
bob <b...@coolfone.comze.com> writes:

> What are some of the most common ways to convert a set of words to an
> identifier?

In Ada you mostly write A_Set_Of_Words, although CIA_Is_An_Acronym.

Other languages I know have less readable conventions. And some
languages even have different conventions depending on what the
identifier refers to.

Greetings,

Jacob
--
"Computer Science is to Science, as Plumbing is to Hydrodynamics"

Daniel Pitts

unread,
May 18, 2012, 1:34:06 PM5/18/12
to
I'd love to see a language/platform where "behind the scenes", the
identifier was opaque (like a surrogate key), and the "name" was
something that was simply attached to the identifier. That name could
therefor be a real phrase, and not constrained to artificial conventions.
0 new messages