Topic: Standard uses long names
Author: tslettebo@hotmail.com (Terje Sletteb?)
Date: Fri, 11 Jun 2004 16:12:06 +0000 (UTC) Raw View
kprateek88@yahoo.com (Prateek R Karandikar) wrote in message news:<607f883e.0406091740.52801455@posting.google.com>...
> Why does the Standard use such long names like InputIterator,
> OutputIterator, ForwardIterator, BidirectionalIterator,
> RandomAccessIterator, RandomNumberGenerator, Predicate,
> BinaryPredicate, Function, Compare, etc
Those are generic concepts, and as such, have the above standard
names.
The names you use for variables and types in your code is of course
completely up to yourself.
> which make the code really unreadable?
Unreadable? Why would they be that? I find them perfectly clear, as
they are spelt out in full. There's no ambiguity at all. Furthermore,
this way, you avoid the risk of these concepts being abbreviated in
subtly different ways, creating a "creative" situation for the
maintenance programmer...
See for example #25 in "How To Write Unmaintainable code - Naming":
http://mindprod.com/unmainnaming.html
See also the Boost naming guidelines
(http://www.boost.org/more/lib_guide.htm#Guidelines):
"- Choose meaningful names - explicit is better than implicit, and
readability counts. There is a strong preference for clear and
descriptive names, even if lengthy"
> (As a proof of unreadability, how many of you read every
> word of the previous sentence fully?)
I did.
> Why not use TC++PL style names:
> In, Out, Bi, Ran, Pred, BinPred, Op, BinOp, etc? This will, IMHO, make
> the code far easier to read.
It's shorter to write, and also shorter to read, and for variable
names they may make sense. This doesn't necessarily make them easier
to understand, and it could make it more difficult.
A general guideline is to have the length of names vary with the size
of the scope. For a loop, "i" would do as a variable name, while it
may be less appropriate for a global variable.
How you find "In" more readable/understandable than "InputIterator",
when you don't know anything else about the name, is frankly beyond
me.
Regards,
Terje
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Thu, 10 Jun 2004 17:42:56 +0000 (UTC) Raw View
Why does the Standard use such long names like InputIterator,
OutputIterator, ForwardIterator, BidirectionalIterator,
RandomAccessIterator, RandomNumberGenerator, Predicate,
BinaryPredicate, Function, Compare, etc which make the code really
unreadable? (As a proof of unreadability, how many of you read every
word of the previous sentence fully?) Why not use TC++PL style names:
In, Out, Bi, Ran, Pred, BinPred, Op, BinOp, etc? This will, IMHO, make
the code far easier to read.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To iterate is human, to recurse divine.
-L. Peter Deutsch
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: v.Abazarov@comAcast.net (Victor Bazarov)
Date: Thu, 10 Jun 2004 19:38:17 +0000 (UTC) Raw View
Prateek R Karandikar wrote:
> Why does the Standard use such long names like InputIterator,
> OutputIterator, ForwardIterator, BidirectionalIterator,
> RandomAccessIterator, RandomNumberGenerator, Predicate,
> BinaryPredicate, Function, Compare, etc which make the code really
> unreadable? (As a proof of unreadability, how many of you read every
> word of the previous sentence fully?) Why not use TC++PL style names:
> In, Out, Bi, Ran, Pred, BinPred, Op, BinOp, etc? This will, IMHO, make
> the code far easier to read.
_You_ think it will make it easier, the Committee probably came to
the opposite consensus.
BTW, how many of us read the rest of your sentence which started with
"why not" fully? As proof of readability, I mean...
"Opinions are like a$$holes, everybody got one and they all stink"
-- origin is unknown (to me, anyway)
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]