On Sun, 6 Aug 2000 01:13:22 +1000, [EMAIL PROTECTED] wrote:
>* Variables are things are nouns. Give them noun names.
> $name, $total, $input
>* Plural variables should have plural names
> @employees, @items, %contact_details
Hmmm...
>* Hash names should be written so that looking up an element reads clearly:
> $email_address{Skud} reads as "the email address of Skud"
>* Hashes with scalars as values should have singular names:
> my $address = $email_address{Skud};
>* Hashes with arrayrefs or hashrefs as values should have plural names:
> my @addresses = @{$email_addresses{Skud}};
I can relate to that.
But those two groups of rules contradict each other. Or, do yo want
$email_address{Skud} to be an element of the hash %email_addresses?
I've used both @item and @items as names for arrays. It depends on
whether I always use the data as a whole (@items), or mostly accessing
individual items, as in $item[3]. $items[3] does not look too well.
Yes, I'm being inconsistent, I know.
p.s.
> o While short identifiers like $gotit are probably ok,
> use underscores to separate words. It is generally
> easier to read $var_names_like_this than
> $VarNamesLikeThis, especially for non-native speakers
> of English.
Pooh.
But I do like the irony that the latter, $VarNamesLikeThis, is sometimes
called "Camel case": lots of lumps.
--
Bart.