Re: Suffix _T for types found good
- From: "Steve" <nospam_steved94@xxxxxxxxxxx>
- Date: Fri, 8 Aug 2008 06:46:19 -0700
"Jeffrey R. Carter" <spam.jrcarter.not@xxxxxxxxxxxx> wrote in message
news:Y9Imk.287972$yE1.85979@xxxxxxxxxxxx
amado.alves@xxxxxxxxx wrote:
IIRC the rationale for "index : anIndex" is that it sounds like
English "index is an Index". Natural language syntax is a bitch!
"Index is an index" is at best a tautology and at worst meaningless; in
other words, this approach adds no value. Yet another mindless rule to
avoid the effort of thinking up good names.
"Index" is a poor variable name. What is it the index of?
First_Comma : Index_Value;
Start_Position : Index_Value;
and so on. Good names add information.
Funny, with my simple example of anIndex you comment that anIndex is
meaningless and go on to use Index_Value as being more informative. Your
example is to simple and worthless as well. All variables contain values.
Perhaps a better example is more like:
lengthIndex : aLengthTableIndex;
is more useful.
And yes the way I read it is in the natural language way:
lengthIndex is a length length table index.
I've seen code that uses the a prefix on variable names. After getting used
to the opposite convention it makes it hard to read.
Personally I prefer the _Type and _Acc_Type suffixes.
One other thing to note: Once I got used to reading and writing code using
these conventions, I found:
1) It makes reading code that follows these conventions a lot easier
2) It makes reading code that does not follow these conventions harder
(you get used not having to infer based on context).
Regards,
Steve
--
Jeff Carter
"To Err is human, to really screw up, you need C++!"
Stéphane Richard
63
.
- Follow-Ups:
- Re: Suffix _T for types found good
- From: Jeffrey R. Carter
- Re: Suffix _T for types found good
- From: Ray Blaak
- Re: Suffix _T for types found good
- References:
- Suffix _T for types found good
- From: amado . alves
- Re: Suffix _T for types found good
- From: Peter C. Chapin
- Re: Suffix _T for types found good
- From: Steve
- Re: Suffix _T for types found good
- From: Colin Paul Gloster
- Re: Suffix _T for types found good
- From: Ray Blaak
- Re: Suffix _T for types found good
- From: amado . alves
- Re: Suffix _T for types found good
- From: amado . alves
- Suffix _T for types found good
- Prev by Date: Re: How to implement a server socket compatible to telnet?
- Next by Date: Re: SOCI-Ada: The Database Access Library for Ada
- Previous by thread: Re: Suffix _T for types found good
- Next by thread: Re: Suffix _T for types found good
- Index(es):
Relevant Pages
|