* Dave Harris:
ia******@hotmai l.com (Ian Collins) wrote (abridged):
>What's wrong with isEmpty()? Sums up the comment and is unambiguous.
"IsEmpty" is hardly better than "empty" in that both assume the reader
knows what "empty" means. As I explained, projects often develop
specialised vocabularies that need to be documented.
(What's wrong with "isEmpty" specifically is that it's inconsistent with
std::vector; but we're surely talking general principles here and don't
want to nit-pick details of the examples.)
Conforming to a convention just for conformance's sake is seldom a good
idea.
The C++ standard library constitutes a fine set of examples of how to
/not/ name things, a standardized "worst practice", which it's not a
good idea to conform to -- presumably the idea was to force novice C++
programmers to struggle with these names and so understand, from the
inflicted pain, what to avoid in their own code (it would be nice to
also have a set of "best practice" examples in the standard, carrots in
addition to the sticks, and there are some, e.g. the names 'list' and
'vector', which are short, readable and self-documenting names, but
unfortunately only the stick method of providing how-not-to-do-it
examples now seems to be in vogue with the international C++ committee,
and now applied also to the language itself, e.g. 'declspec').
And 'empty' is perhaps one of the best of these "worst practice"
examples, because it's short and readable and actually related to what
the function accomplishes, while suggesting something else, namely
suggesting an action (make empty) instead of a check (is empty), thus
sending the unsuspecting novice in the wrong direction first.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
[ See
http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.m oderated. First time posters: Do this! ]