http://qs321.pair.com?node_id=965211

I'm curious to know when we should or shouldn't be abrupt to newbs regarding responses to their coding issues. This is a very theoretical question. I'm not claiming right or wrong, I'm just interested to know when past Perl code should be looked at as obsolete in our responses. For instance... suppose someone says:

I'm trying to iterate through an array, and I'm doing the following.

my @a = qw( a b c ); for ( my $i=0; $i<3; $i++ ){ say $a[$i]; }

We could bitch that we don't do "C for loops" and respond like this:

for my $elem ( @a ){ say $elem; }

But what if they wanted the iteration number? We could throw out (what I just learnt yesterday a trick that was back-ported from Perl6 into 5.12 (each for arrays))

while ( my ( $iter, $elem ) = each @a ){ say "Iteration $iter contains $elem"; }

...but where does it end? Do we have a common guide to follow when responding to questions here on PM?

ps. This question goes much deeper than coding questions, but you know that. Is there consistency is my inquiry...

Replies are listed 'Best First'.
Re: When do we change our replies?
by ww (Archbishop) on Apr 16, 2012 at 02:01 UTC
    "We could bitch that we don't .... "

    Or, we could point out that using a C-style loop is un-lazy and thus unPerlish, without bitching. Without the explanation of why we offer the alternate syntax, the reply probably wouldn't be much help to a newcomer... and a newcomer who takes the trouble to include code, pay attention to formatting and some of the other desiderata listed in our FAQs deserves (IMO) the best possible answer... given any shortcomings (if any) in the problem statement.

    "But what if they wanted the iteration number? "

    Again, IMO, if they didn't mention that in the OP or a follow up, should we try to use our broken crystal balls to guide our replies?

    As to a common guide, which I believe is the subject of your question given the amplification in your last sentence, "Is there consistency is my inquiry..." -- I'm not aware of one, other than the examples provided by the most knowledgeable and helpful Monks. And as several recent threads have highlighted, there's certainly something less than consensus about just how to handle the worst of poorly written questions and the "gimme's."

    Addendum:

    Suppose the next SOPW you see goes like this:

    OP: How do I print hello?

    A1: Use print which is explained in print.

    Q2: Yeah, but how do I do that?

    A2a: Read the documentation linked in A1.
    A2b: What have you tried? Show us your code and we can probably help you.
    A2c: The answer is shown in Perl versions of 'Hello, world.' Google can help you find your answer. We don't write your code for you, but we'll be glad to help you learn if something's still not clear.

    Q3: You're not telling me what I need to know. And anyway, those samples show how to print something to a screen. I want to print it to dead treees and since you're experts you can just tell me how to do it.

    A3: There are several answers to that:

    • You didn't make your question specific when you first asked it..."print" often means "print to screen and I suspect A1 and A2c thought that was what you meant.
    • To do what you want you'll need to read (...good doc refs)
    • Yes, we could tell you how to do it, but you'll learn more by studying and trying to do it on your own. We're here to help when your attempts fail (but note A2b).

    Q4: So go to hell if you don't want to help, you #){P*{ monkeys! I bet I'll get an answer at StackOverFlow, so there...

    Is A1 a "good" answer: I would argue 'yes' as it tells someone who looks to be a beginner how to find some documentation... a skill that beginner will need to progress beyond the novice level.

    But how about answer A2a thru A2c: To my taste, c is the best answer, because the writer now has some evidence that the OP is looking for a script rather than information or knowledge... a view that (in my eyes) is reinforced by the OP's final statement.

    That said, if you emulate the form of replies you admire, you'll develop your own style of helpful responses.

      That said, if you emulate the form of replies you admire, you'll develop your own style of helpful responses.

      I am finding this, at a slower pace than I am finding my own coding style.

      Thanks, ww

      A good general rule is if you are no longer being polite then it's time to bail. A2c fails on that front, so bail. A2a seems to be pointless unless you think they missed the link, so bail. A2b is okay, though I would suggest asking them directly what they find confusing and then bail if they still show little to no effort. Q3 is clearly time to bail, and may be time for Consideration. Q4 probably deserves to be reaped.

      Elda Taluta; Sarks Sark; Ark Arks
      My deviantART gallery

        Why do you say "A2c fails on (the politeness) front?" What criteria for politeness am I simply not seeing?

      Your addendum is a blatant strawman argument. On a site that sees at most 15 SoPWs per day how many of those are anywhere near what you describe? Let's give you the benefit of the doubt and say 20%, about three, every day violate your specific terms of service. So what?

      Is it that overwhelming an amount for the current regulars to handle? Are these three or four so difficult to ignore approving, front paging or answering? If so that doesn't speak well for this place.

      I like to think most monks have been a little more capable of being able to tell what is worth their time

        Right now, we suffer from a practice (NOT a "policy") of approving almost anything which is not blatantly off topic or outright spam. That's an unfortunate practice that seems, to me, to have developed over the last two or possibly three years.

        And guess what: in the same span, the volume of well-written SOPW has diminished.

        Worse, we have some folk (XP whoring? unable to evaluate the quality of a post? something else?) upvoting questions like the initial one in the thread you characterize as a strawman argument. Take a look at the last 24 or 48 hours worth of new questions. There are certainly some good ones, well asked; formatted readably; and non-obvious. But then look at the rest.

        Now, I know the phrase "non-obvious" is a red flag to some, so just to make it clear: If the question is "how do I print hello? I don't understand (some quote from a doc or example). I regard that as a perfectly reasonable question. I still have times when the documentation seems as opaque as some of our laws, but I don't regard a question as reasonable if it leads me to believe the poster hasn't even tried to solve the problem other than by asking others to solve it.

Re: When do we change our replies?
by moritz (Cardinal) on Apr 16, 2012 at 02:26 UTC

    I really like to see replies that not only answer the question, but contribute to the education of all readers in terms of idiomatic Perl and robust programming (always in the context of the original question, of course).

    Those and the discussion culture are what makes perlmonks different from sites like stackoverflow, which aim toward one "correct", canonical answer.

      ...contribute to the education of all readers including myself...

      Thanks moritz, I completely concur with your entire take on the matter.

Re: When do we change our replies?
by tinita (Parson) on Apr 16, 2012 at 00:38 UTC

    I'm not sure if you're asking if you shouldn't post such suggestions at all or if you shouldn't post too much.
    I don't see a problem at all.
    Suggesting more modern or more perlish code is of course a good thing. Often you can guess from the OP question how much explanation you should add to your suggestions.
    The each example would need a hint that it only works for at least 5.12.
    If you leave it off and the OP needs the index, then they can ask.
    Your suggestions might not solve the original problem, but that's no reason to not post them. Add explanations, or if you have less time, link to a tutorial.
    My experience is that some people say "thanks, I didn't know that syntax", a few ignore it, and only rarely there are users who say "don't suggest that just because it's considered modern at the moment".

      Merci beaucoup tinita for the response.

      However, I will refrain from responding for the time being as I await further feedback.

Re: When do we change our replies?
by Anonymous Monk on Apr 16, 2012 at 01:51 UTC
Re: When do we change our replies?
by jdporter (Paladin) on Apr 16, 2012 at 01:40 UTC

    So what you're really asking is how do we handle the XY problem. ;-)

      I do like pointing people to answers, and even enjoy writing out homework code, because it helps me learn, even when it isn't in the best interest of someone who doesn't know the coding trick I might.

      However, I'm also down for saying "look up your own stuff". This type of statement might even come out of me depending on the type of day I'm having. This type of inconsistency isn't good for PM as a whole imho. It isn't good for anyone if I make a statement to a newb today based on my emotions that I might not make tomorrow.

      We are all newbs once, and we all know more, and less than someone else.

      I guess what I'm wondering, is if there is a chance we can hash out some form of consistent guideline for the mid-line people in PM to follow, so we have consistent advice for newcomers to keep the newbs feeling comfortable coming back.

        I guess what I'm wondering, is if there is a chance we can hash out some form of consistent guideline for the mid-line people in PM to follow, so we have consistent advice for newcomers to keep the newbs feeling comfortable coming back.

        Yuck, please no, that sounds awful.

      In essence, Yes, and no

      It is how we collectively as a group to respond to questions such as (as a worst-case scenario):

      I can't fix this shit. I don't have code, but I want an answer.

Re: When do we change our replies?
by JavaFan (Canon) on Apr 16, 2012 at 09:04 UTC
    We could bitch that we don't do "C for loops"
    Or, we could consider ourselves Perl programmers, and acknowledge that "there's more than one way of doing it".
    But what if they wanted the iteration number?
    It's really bad to answers questions by assuming hidden requirements. Not answering is superior in that case. If a requirement isn't in the question, don't assume it is.
    each for arrays
    On p5p, the current feeling about that is "we wish we never implemented this".
    Do we have a common guide to follow when responding to questions here on PM?
    A common guide? Buhahahah. It's hard to get consensus even if you were to pick no more than two people from here at random. Other than guides people may have for themselves, there's no guide. Let alone a common one.
    This question goes much deeper than coding questions
    Actually, I find your questions shallow. Particular the question whether there's a guide: to me it says you're afraid of being yourself, and prefer to follow what someone else cooked up for you. Instead of meekly asking how you should behave, why not tell us how you answer, motivate it, and be prepared for criticism? That maybe useful, as it can help others decide (or change) how to respond.
Re: When do we change our replies?
by halfcountplus (Hermit) on Apr 16, 2012 at 13:35 UTC

    I'd agree with the other people here who have said essentially, 'don't bitch that "we don't do C for loops"'. To me, the most perlish of all things is TIMTOWTDI. In the case of iterating an array, I would point out that it is more common to do it another, probably easier, way, but I wouldn't say that you should never do it C style (even if I don't).

    Unbest practices of greater significance (such as bareword file handles) are important to point out, along with an explanation of the issue. But if the "issue" is essentially a matter of style, then be clear about that. Don't use scare tactics, lol.

Re: When do we change our replies?
by stevieb (Canon) on Apr 18, 2012 at 04:44 UTC

    I want to acknowledge all respondents on this thread. I have received feedback that was typical of what I expected and also what I was hoping to hear.

    My goal was to see what was out there, and I'm certain there has been an effect and an affect.

    PM (imho) needs a little bit of a re-shaping, but that is the guidance I was looking for.

    Not only did I see who responded, but felt who was overlooking this thread. I don't know them by anything other than their PM names, but I have seen some of their work outside of this site. They stand for what they believe in, they are diligent and confident, and won't back down or delete shit if called on something.

    I'm not a great coder, but I am someone who cares as much about Perl as I do a newbie. However, lines must be drawn, as I'd rather code than have to put "show code" in a sig.

    To those on-list, and also those off-list who I've spoken to, merci beaucoup. It is up to you to lead the way for the next generation of lvl9's that are up and coming. This topic was trying to find my own selfish way in regards to PM as a whole.

Re: When do we change our replies?
by stevieb (Canon) on Apr 16, 2012 at 02:11 UTC

    I suppose another thing I'm taking very seriously, is my approach to lvl9, and the responsibilities that it carries. I've read everything I can about it, and I want to ensure that I am fit for the community as a whole, not basing things on my own perception.

      I hope it does not make me a lazy or irresponsible person if I admit I don't use the approval nodelet much other than occasionally voting on considerations. I mostly just go to the "Newest Nodes" page, so I guess this has less significance for my experience here than it might for others.

      I think the community system, moderation, etc, is a good thing, but since the site already seems well run to me, I don't worry about it. Of course, I'm presuming that the more active moderators are not stressed out by it, and that if they were they'd speak up, as I'm sure there are people (eg, me) who'd be willing to contribute more that way if there is a perceived need for it.

      later: Thanks for bringing this up, actually. It made me reconsider my laissez faire attitude a bit.

Re: When do we change our replies?
by Anonymous Monk on Apr 16, 2012 at 19:11 UTC

    I like this place a lot better when monks act like *Perl* Monks rather than *Pedantry* Monks. This OP, comments over the past week and some of our monks' habitual reactions to /bad/ etiquette make it feel more like the latter too often.

Re: When do we change our replies?
by stevieb (Canon) on Apr 18, 2012 at 06:52 UTC

    This has been the most enlightening experience I've had here. I'm glad I brought this up :)