Re: How to name variables in a program?



On Sat, 28 May 2005 05:18:01 +0200, "SerGioGio" <nospam> wrote:

>Hello,
>
>Having a strong convention for naming your variables in your program is an
>important issue often overlooked.
>Can anyone point me to a good source on the web dealing with this issue?

I read a study once that said that the important thing was to use a
standardized set of abbreviations and naming conventions. The study
had actual metrics for what that might be worth. My take is that
names shouldn't be too long, i.e., names longer than ordinary words
are obfuscation. (Indeed any name longer than "obfuscation" is too
long.) Abbreviations are fine, e.g., ptr for pointer, provided (a)
they are evocative and (b) there are no variants.

The odd thing is that natural languages are defined by their
vocabulary whereas computer languages are defined by their grammar.
That is, one cannot understand a natural language, e.g., English,
without knowing the meaning of a good number of words, not counting
words such as "have", "had" and "to" that are part of the grammatical
superstructure. In computer languages the grammatical structure terms
(keywords) are all there is; each program makes us its own
idiosyncratic dictionary.



Richard Harter, cri@xxxxxxxx
http://home.tiac.net/~cri, http://www.varinoma.com
Save the Earth now!!
It's the only planet with chocolate.
.



Relevant Pages

  • Re: How to name variables in a program?
    ... The Java naming convention is pretty good on this. ... the symbol is with the first letter capitalized, ... I would also *HIGHLY* warn you against the hungarian notation. ...
    (comp.programming)
  • Re: Naming of private functions
    ... > Naming conventions are intended to give the reader a way ... > your project the access rights to the symbol make such ... > convention for the functions, ... They can't justify it rationally to me, ...
    (comp.lang.cpp)
  • Re: Naming Standard
    ... The RVBA (Reddick VBA) naming conventions are available ... > Convention, derived from the Leszynski*-Reddick Naming Convention for ... > Microsoft has something on this in the Knowledge Base, ...
    (microsoft.public.access.gettingstarted)
  • Re: Questions about app design - OOP with python classes
    ... It's unreliable in the sense that the coder has to follow the naming ... convention, and must have some bare minimum of sense. ... I'd have expected the compiler to handle the conversions through casts ...
    (comp.lang.python)
  • Re: great idea -- explain own bids
    ... naming a convention is not illegal, ... give full disclosure. ... experienced players, you can just say "Inverted", the opps nod ...
    (rec.games.bridge)