'Nother one to consider: Make the readability of names proportional to their scope.

You don't need long names for short-lived carrier variables:

my $d = $object->{'some'}->{'deeply'}->{'nested'}->{'item'}; _foo ($d->{'bar'}, $d->{'baz'}); $object->validate_range_params ($d->{'bar'}, $d->{'quux'}); { and $d will never be used again after this point }

but it does make sense to use long, descriptive names for things that will be used far away from where they're defined.

The same applies to functions. It's okay to short names for internal functions (the ones you'd start with an underscore), because you won't see them being used unless you're close enough that you can find the definition and read the associated comments. For exported functions, even though people do hate typing the long names, it's worthwhile to add a few characters that will save people from having to RTFS in order to learn what the thing does.

Used consistently, the readability of a name can cue you in to how far you'll have to look to find the original definition.


In reply to Re: coding rules by mstone
in thread coding rules by punkish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.