Integer conversions too pedantic in 64-bit
Nick Sabalausky
a at a.a
Tue Feb 15 13:45:13 PST 2011
"Adam Ruppe" <destructionator at gmail.com> wrote in message
news:ije0gi$18vo$1 at digitalmars.com...
> Sometimes I think we should troll the users a little and make
> a release with names like so:
>
> alias size_t
> TypeUsedForArraySizes_Indexes_AndOtherRelatedTasksThatNeedAnUnsignedMachineSizeWord;
>
> alias ptrdiff_t
> TypeUsedForDifferencesBetweenPointers_ThatIs_ASignedMachineSizeWordAlsoUsableForOffsets;
>
> alias iota lazyRangeThatGoesFromStartToFinishByTheGivenStepAmount;
>
>
> Cash money says everyone would be demanding an emergency release with
> shorter names. We'd argue for months about it... and probably settle
> back where we started.
A small software company I once worked for, Main Sequence Technologies, had
their heads so far up their asses it was trivial for me to get posted on
TheDailyWTF's Code Snippet of the Day (This company had a
rather...interesting...way of creating their "else" clauses).
One of the many "Programming 101, Chapter 1" things they had a habit of
screwing up was "Use meaningful variable names!". Throughout the codebase
(VB6 - yea, that tells you a lot about their level of competence), there
were variables like "aaa", "staaa", "bbb", "stbbb", "ccc", etc. Those are
actual names they used. (I even found a file-loading function named "save".)
Needless to say, trying to understand the twisted codebase enough to
actually do anything with it was...well, you can imagine. So I would try to
clean things up when I could, in large part just so I could actually keep it
all straight in my own mind.
Anyway, to bring this all back around to what you said above, there were
times when I understood enough about a variable to know it wasn't relevant
to whatever my main task was, and therefore didn't strictly need to go
wasting even *more* time trying to figure out what the hell the variable
actually did. So I ended up in the habit of just renaming those variables to
things like:
bbb
->
thisVariableNeedsAMuchMoreMeaningfulNameThan_bbb
That was satisfying ;)
Call it "self-documenting code".
More information about the Digitalmars-d
mailing list