1

Can we have a pop-up if a code-only answer is detected? A possible requirement would be having a minimum length of 30 non-code characters. The goal is to avoid "Try this" answer.

This will not stop all lousy answers, but will at least encourage more good ones.

Like:

enter image description here

16
  • 12
    We treat questioners like children that cannot be held responsible for their contributions, if answerers need to be treated like that as well then nobody can be held accountable for the quality of the Q+A here. Do not encourage that kind of attitude, nothing good can come from that. You have tools available already, just use them. Commented Feb 8, 2016 at 10:40
  • 2
    @HansPassant the posts come into the low quality review queue, and people comment, and vote, nothing much happens. Is there anything wrong with wanting to circumvent this?
    – user3956566
    Commented Feb 8, 2016 at 10:41
  • 7
    @HansPassant Are you saying the existing restriction on questions is not good since it treats questioners like children?
    – Tunaki
    Commented Feb 8, 2016 at 10:46
  • 4
    @HansPassant But many questioners and answerers are children.
    – Magisch
    Commented Feb 8, 2016 at 11:50
  • 5
    Most of the times, people will add noise to workaround it. "hope this helps", "have a good day", "if you have further questions please don't hesitate to ask"(last one already passed 30 chars by itself) etc. And that will create more work on editors.
    – Lafexlos
    Commented Feb 8, 2016 at 12:26
  • nobody can be held accountable for the quality of the Q+A here : isn't that already the case ?
    – 2Dee
    Commented Feb 8, 2016 at 15:05
  • 2
    Related: How to deal with post containing only code
    – vard
    Commented Feb 8, 2016 at 15:06
  • 1
    If the goal is to avoid Try this answers, then just reject answers whose first line only consists in Try this. Sure, they will find another type of filler to use, but at least we'll have some variety. Commented Feb 8, 2016 at 15:31
  • The fact that most answers benefit from non-code text doesn't change that many answers do not. Code-only answers are NOT a good candidate for an outright ban. At some point you need to allow the people making good answers enough latitude to make those good answers...and sometimes the best of the best kind of answers are the ones that recognize an opportunity where extreme brevity works, such as an extremely simple code-only answer. Take away that ability and you make your review queue shorter with less low-quality's... but you're also skimming off the top of the high quality answers too. Commented Feb 9, 2016 at 17:04
  • @JimboJonny I'm voting to close this as offtopic for a comment, this should be converted to an answer.
    – user3956566
    Commented Feb 10, 2016 at 1:08
  • I wish people would stop flagging code only answers.
    – user3956566
    Commented Feb 10, 2016 at 1:09
  • @MsYvette - It's a direct response to the comments about it helping the low-quality queue, addressing the fact that while it will help the low-quality queue it will also harm high quality answers too. As all discussion about it being for the sake of the low-quality queue is currently in the comments, not the question, I stand by that response being in the comments, not being posted as an answer. Commented Feb 10, 2016 at 1:52
  • @JimboJonny it was a joke. Besides it illustrates my point that code only answers are not ideal, as you have an answer and yet your comment is longer than your answer.
    – user3956566
    Commented Feb 10, 2016 at 2:00
  • @MsYvette - The fact that my answer is shorter than the average comment is exactly why it's a good answer. It's also why I have code-only answers on SO that are rated 10x+ higher than the next highest code+explanation answer for the same question. Commented Feb 10, 2016 at 3:03
  • @JimboJonny if your answer here was complete, you wouldn't need to be making lengthy comments. I'm not replying to this again.
    – user3956566
    Commented Feb 10, 2016 at 3:27

4 Answers 4

21

A code-only answer may be infused with helpful and instructive comments the answerer felt would be more useful if nestled among the code. Enforcing some non-code-block character limit outside it would harm those answers while encouraging the "Try this" people to try to cheat it with:

Try this........................

In code-only questions, we already often see a sentence added to the bottom

I added this because it won't let me post only code... I added this because it won't let me post only code...

...and we'll just end up with the same noise applied to answers (which is arguably even worse).

If an answer has a poor explanation or no explanation, downvote it (even if it's functionally correct!). Include a comment as to why you downvoted it and the answerer will quickly learn not to do that. You won't change their behavior with an arbitrary limit. You'll change it with your votes.

7
  • 1
    They end up in the low quality queue and there's plenty of experienced users doing it, who are capable of adding a decent reason. There could easily be a check for repeated chars .................
    – user3956566
    Commented Feb 8, 2016 at 2:51
  • 9
    Experienced users are even more deserving of downvotes. And if it isn't repeated characters, it will be something else Try this code it will help you is equally common. Commented Feb 8, 2016 at 2:53
  • 1
    True, there is that. Btw I love the camel. When I wrote this, I was aware it wouldn't stop all lousy answers, but may encourage more good ones.
    – user3956566
    Commented Feb 8, 2016 at 2:54
  • There is also a requirement for 15 characters in comments and I can't recall even one case of padding text in comments with ............... or something like that. Commented Feb 8, 2016 at 11:53
  • Wow, @user1803551. I certainly can. Happens a lot on the tags I monitor. There were even creative workarounds people came up with using Unicode zero-width joiners. Not sure if those loopholes were ever closed.
    – Cody Gray Mod
    Commented Feb 8, 2016 at 12:31
  • @CodyGray Yes, me as well. And while I don't think I've ever padded a comment with repeated characters myself, I'm pretty sure I've at least reworded them from time to time, increasing my verbosity to meet the limit. Commented Feb 8, 2016 at 12:36
  • 2
    @Cody Nope.​​​​ Commented Feb 8, 2016 at 16:09
11

I don't think I'd want an explicit hard limit - some answers are short, and that's okay.

But I do think a soft "suggestion" is a good idea: just a reminder, particularly to folks who aren't used to how to answer yet, that good answers usually include some explanations. Maybe one that's only applicable to <2000 rep (or some smaller number) users. Just not something that forces users to enter text to override it.

4
  • 1
    I think that the idea of a suggestion is good, sort of like the "avoid extended discussion in comments" warning. Commented Feb 8, 2016 at 15:16
  • 2
    Well it is already suggested in the How to answer help page: "Brevity is acceptable, but fuller explanations are better."
    – vard
    Commented Feb 8, 2016 at 15:47
  • @vard That's a good line, though I would prefer something just slightly more clear. I think many users - particularly ones from other sites - believe if a question asks for something answerable with code, that code is the right answer, by itself. Something specifically addressing that would be ideal.
    – Joe
    Commented Feb 8, 2016 at 15:57
  • 1
    I think this is an awesome idea. Ironically, I am not opposed to code only answers, have never flagged one, it's just they keep ending up in the low quality review queue.
    – user3956566
    Commented Feb 8, 2016 at 17:17
9
sometimes = verbosity!==quality;

if (!normalText.needed) {
    dontUseNormalText();
}
13
  • 6
    Yes, but WHY is that the right answer?
    – krillgar
    Commented Feb 8, 2016 at 15:15
  • 1
    @krillgar if (code===answer && !normalText.needed) { normalText = verbosity; verbosity = harderToRead(); } Commented Feb 8, 2016 at 15:21
  • @krillgar - JimboJonny.highestVotedAnswerEver = code.only; Commented Feb 8, 2016 at 15:23
  • 4
    I tried this but it does not work?! Can you post full code, because I didn't learn the idea behind the code?
    – user694733
    Commented Feb 8, 2016 at 15:24
  • @user694733 - isTrueInAllCases = false; isTrueInSomeCases = true; Commented Feb 8, 2016 at 15:26
  • @JimboJonny You didn't use ==, so of course that's returning true...
    – Joe
    Commented Feb 8, 2016 at 15:58
  • 1
    This is a code-only answer with no explanation. To encourage users to understand what they're writing and way, please include an explanation of how your code works.
    – ssube
    Commented Feb 8, 2016 at 16:32
  • @ssube - If I may break character for a moment: my highest rated answer (+62) is a 2-line code-only answer which shows document.getElementById being null when there is no element with that id. The next answer below it is an equally simple textual explanation that the same function returns that same result. In the same amount of time as my answered has garnered +62, that answer has garnered +2. The users have spoken. Sometimes, when the code is simple enough, an explanation does not aid in understanding. The code itself IS the most powerful explanation in such cases. Commented Feb 8, 2016 at 16:51
  • 1
    Pointing out that sometimes code requires explanation does not change the fact that sometimes it doesn't. Commented Feb 8, 2016 at 16:53
  • 1
    @JimboJonny there are rare occasions, typically on fairly straight-forward questions, where code-only may fully answer the question. It rarely hurts to include a short description, or even just a link to the MDN page or reference in the spec (for people interested in more detail).
    – ssube
    Commented Feb 8, 2016 at 16:54
  • @ssube - Your argument would be a great argument for a general guideline of "it's usually good to include an explanation." but NOT for an actual ban of answers with only code...as in some cases they are not only valid answers, but the best answers. It is the latter that this topic suggests, not the former. Commented Feb 8, 2016 at 17:00
  • @ssube - Case in point: the same question I reference above about finding if an HTML tag with a certain ID exists via JS. Of answers posted same-day (for fair comparison) 2 answers are code only (+62 and +43), 1 answer is the code plus explanation (+6), and 1 is just an explanation (+2). All 4 are extremely short, and very much correct and complete. However, the vote differentials are clear. We're talking about, in some cases, people finding code-only to be the massively more appropriate answer. The fact that most answers are better with explanation does not justify banning all code-only. Commented Feb 8, 2016 at 17:23
  • @JimboJonny After your comments, I now understand where you stand. Maybe you should include that into you answer?
    – user694733
    Commented Feb 9, 2016 at 9:09
-1

While good answers typically won't be code only, at least sometimes any verbal explanation beyond the code just adds clutter. For example, in the Python tag, it isn't uncommon that a questioner is asking for a list comprehension to solve a certain problem and the answer is just a 1-line list comprehension. No real point to launch into an explanation of how list comprehensions work. Thus, I would oppose anything which outlawed code-only answers, though I think that @Joe 's idea of a suggestion is good.

You must log in to answer this question.