Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://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".

Regards,
-- Hauke D


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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (None)
    As of 2024-04-25 00:02 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found