Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hi Alexander,

I agree with many things in your meditation. I do want to provide some counterpoints to a few things.

But no, we should not show beginners the most dirty ways first.

I absolutely agree, if the emphasis is on "first". But I think it's a little unfair to pick on 1172628: it was posted several days after two very good replies showing the better way to accomplish the OP's goal, it does contain a disclaimer, and I'm pretty sure it'll stay near the bottom of the page. The only thing I felt missing in that node is a discussion of strict, which I have now added in a reply.

... Not even with warnings not to use the dirty ways in production code.

I disagree: If a question is first answered with the "best practice" way, then I think that posting the one-liner or "bad" way afterwards - with a prominent disclaimer - isn't a bad thing. People who are just looking for a quick answer to copy-and-paste into their script (of whom there are many) will use the first thing they find, which will usually be the first and/or most-upvoted answers, especially since the relatively recent change that replies are sorted "best first" by default. But threads are read by many more people, and those who actually want to learn Perl (hopefully including the OP) can scroll down, and they will learn something interesting.

People will always find bad code all over the 'net and use it. Just the other day I came across a blog posting showing an arguably bad snippet of Perl code, and the only indication that there was something wrong with it was if you scrolled down into the comments section (which had a tiny font). So instead, I think that showing both the right way(s) and the "wrong" way with a prominent disclaimer will help people to differentiate between the two, and to learn why something is "bad".

Note that I'm putting "bad" and "wrong" in quotes here because I'm a fan of TIMTOWTDI, while at the same time I think that guiding people to using the best practices is also a Good Thing.

There lots of threads where I see replies and think "I wouldn't have posted that", such as the many cases where people get code written for them where I happen to feel they haven't shown enough of their own efforts. But getting frustrated that I can't control what other people post is not the answer :-)

Instead I like the system that is already in place: Replying to nodes that contain "bad" code, and the voting system. Monks who truly want to contribute will quickly learn that posting replies that adhere to best practices is appreciated by more people. Your meditation is also good reminder of the "best practices of posting".

-- Hauke D

In reply to Re: Don't post bad code! by haukex
in thread Don't post bad code! by afoken

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (4)
    As of 2020-08-13 20:45 GMT
    Find Nodes?
      Voting Booth?
      Which rocket would you take to Mars?

      Results (75 votes). Check out past polls.