Are you saying that following coding style documents is cargo-cult programming? I tend to think that one should follow coding guidelines, no matter how stupid. If they suck, change the guidelines or change your job.

I'm sure you meant that it could be cargo-cult OR it could be adherence to a 'no defaults' style guideline/preference. The only way to know for sure would be to ask the original programmer why he wrote the code that way.

Consider the following code:

my $foo = undef;

The initialization to undef totally unnecessary, but it does communicate an idea: $foo really should be undef, it's not just an oversight.

While I don't use either unnecessary initialization, I don't see them as harmful.

Despite my personal preferences, I can see why someone would choose to explicitly initialize ALL their variables. It's not a bad habit to be in.

I guess the main thing I am trying to say is, don't be in too much of a rush to call something cargo-cult. What we have here could be CC code or it could be the result of a decision based on some painful lessons.


TGI says moo


In reply to Re^3: what is the meaning of (); by TGI
in thread what is the meaning of (); by Anonymous Monk

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.