Re: How to name variables in a program?
- From: websnarf@xxxxxxxxx
- Date: 30 May 2005 15:28:06 -0700
Arthur J. O'Dwyer wrote:
> On Sun, 29 May 2005, Phlip wrote:
> > namespace db {
> > ...
> > class pop3 {
> > ...
> > msg->getHdr();
> > }
> > }
> >
> > Now we need to type db and pop3 less often, so we can safely make them
> > longer. Similarily, the line with msg->getHdr() is now shorter, so we have
> > room to make it longer:
> >
> > namespace eMailDatabase {
> > ...
> > class PostOfficeProtocolThree {
> > ...
> > pMessage->getHeader();
> > }
> > }
>
> I assume you were just casting about for a way to make Paul's 'pop3'
> longer, but surely you know that 'PostOfficeProtocolThree' is a horrible
> name for a class! Rather than obfuscating the fact that the class has
> something to do with POP3 (not "Post Office Protocol Three"), it would
> be better to use a /more/ descriptive name, preferably a noun such as
> 'POP3Interface' or 'POP3MessageInfo'.
Indeed, he just missed my comment about the tendency towards acronyms
and shorthands that is natural and pervasive is general discourse. If
you want to go *that* verbal, put it in a comment. And go ahead and
mention the RFC for it as well. "Post Office Protocol Three" is not
something you'll ever hear in normal conversation outside the
discussion of the RFC itself. The right name *is* POP3; everyone knows
what you mean (even non-programmers might know, if they had to set up
their own mailclient.) Using the full name "database" instead of db,
is just the same thing to a lesser degree.
He also missed the point where I showed his own hyppocracy in using
"HN" to mean hungarian notation. Acronyms are useful, and don't need
to contribute to obfuscation.
> [Paul wrote:]
> >> The other advantage of my scheme is that when you ASCII sort the
> >> symbols, they make some sort of sense and look fairly organized
> >> anyways.
>
> ;-) Wouldn't they look even more organized if you named them
> alphabetically starting at 'aa' and going up toward 'zz'? (If you plan
> to have more than 676 object classes in your program, the natural
> extension to 'aaa'--'zzz' applies.) Point is, /looking/ organized
> and actually /being/ organized are two different things.
Ok actually sorting the names is not the highest concern. But seeing a
list of such functions next to each other is a very common thing.
Knowing that a certain group of them happen to be from the same module
is a useful thing, and a very natural thing if they all have the same
prefix -- this property just happens to coincide with good sorting
properties with other useful naming restrictions.
--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/
.
- References:
- How to name variables in a program?
- From: SerGioGio
- Re: How to name variables in a program?
- From: websnarf
- Re: How to name variables in a program?
- From: Alf P. Steinbach
- Re: How to name variables in a program?
- From: spinoza1111
- Re: How to name variables in a program?
- From: Jens . Toerring
- Re: How to name variables in a program?
- From: websnarf
- Re: How to name variables in a program?
- From: Phlip
- Re: How to name variables in a program?
- From: Arthur J. O'Dwyer
- How to name variables in a program?
- Prev by Date: Re: How to name variables in a program?
- Next by Date: Re: How to name variables in a program?
- Previous by thread: Re: How to name variables in a program?
- Next by thread: Re: How to name variables in a program?
- Index(es):
Relevant Pages
|