Re: How to name variables in a program?
- From: "Joe Butler" <ffffh.no.spam@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 29 May 2005 23:18:05 +0100
<Jens.Toerring@xxxxxxxxxxxxxxxxxxx> wrote in message
news:3fudarF9ja99U1@xxxxxxxxxxxxxxxx
> spinoza1111@xxxxxxxxx wrote:
> f
>
> Just have a look at the source code in what seems to be the original
> paper by Simonyi at
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs600/htm
l/hunganotat.asp
>
> (it's somewhere at the end of the page). The source code gives you
> no indication at all what it does since neither the function nor the
> variable names tell you anything about their purpose. In contrast to
> the intention of the author it's probably difficult to come up with
> an example that more clearly shows why HN is completely useless and
> actually counterproductive.
> Jens
The code was, presumably, intended as an example of how to name various
elements in a typical 'real life' program and not as a demonstration that
comments become redundant once HN is used (which of course they don't). I
would have thought that HN was put forward as a simple dogma to formalise
the naming of variables that everyone could understand and hence avoid the
minimalists' approach to nameing (x, y, z, i, i2, etc.), the wordy
(x_amount, value_y, zAxis, i_count, i_count2, I2Count, etc.), etc. I think
that it's safe to assume that this code was a pre-existing example that was
either fairly cryptic or very long-winded before the HNotation was applied
to it.
If you take the time to read the code line-by-line (as you would if you were
going to actually work on it), then the naming convention is the least of
your problems. It's interesting to note that there are at least 2 cut/past
errors in it. This has gone unnoticed because the general layout,
regardless of nameing convention, is extremely bunched up and ugly. Limited
use of whitespace, lack of bracing for single-line loops, etc.
I'd be interested in seeing how each poster here would have named and layed
out that code example. And then again, how they would have done it in a
production environment with the schedule pressure.
In reality, you get used to most things as long as they are consistent.
Having said that, I'm most annoyed working with programmers that don't
enougth space characters. E.g. for(i=0;i<10;i++) I don't know they write
like that, they wouldn't write without spaces in written English.
.
- Follow-Ups:
- Re: How to name variables in a program?
- From: Arthur J. O'Dwyer
- Re: How to name variables in a program?
- 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
- How to name variables in a program?
- Prev by Date: Re: Advice for mid-life career change (to programming)
- Next by Date: Re: Array Programming Questions
- 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
|