What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

During review, many times (20%-30%) I see answers that are only a code-block. Some examples are SQL queries, CSS queries, any prog. language coding issues. The answer is only a code block. Stack Overflow assumes that these posts are low quality posts, though they are high quality code. Many times they are written by users with reputation scores above 20k or 40k.

So how to improve low quality answers that are only code blocks, so that we can reduce low quality posts on Stack Overflow ? (in /review or while answering questions)

I have seen related questions like this, mentioned below, but have not seen this problem discussed:

  1. How to improve the quality of Stack Overflow questions and answers?
  2. How does Stack Overflow attempt to prevent low-quality questions and answers?
  3. Suggestions to improve the 'Low quality posts' list on review tab

Some things needs to be considered while reviewing this posts:

  1. I have seen many times these sentences written above code block:

    1. Try this code/ sql query
    2. You should use this code/ sql query
    3. Have you tried....

    Should these sentences be removed or not?

  2. What should be included in answer with code so it wouldn't be of low quality? Because many times only code can explain everything required to OP.

  3. How can we teach high reputation users or any users in improving this posts so that upcoming posts of high quality? What comments should write to high rep users so upcoming posts can be improved?

  4. What are do's and dont's while reviewing this posts?

  5. How do you succeeded in improving such low quality posts?

share|improve this question
9  
They are low quality if there isn't enough text to explain why it fixes the problem to a confused reader. Good answers cover the why and the how. It's hard to cover much beyond the how in code only. –  Flexo Jul 17 '12 at 6:48
2  
I doubt that the code is of any better quality than the post itself. –  BoltClock's a Unicorn Jul 17 '12 at 6:49
16  
I find it depressing at times how often high-reputation users post answers like this. –  Andrew Barber Jul 17 '12 at 7:52
4  
Most of the time the problem is: You can't. You may not have the insight into the code to actually probably document it, but the author could (commenting might be an option). Also, questions which are easily answerable with only a few lines of code, have a very bad smell. –  Time Traveling Bobby Jul 17 '12 at 8:17
1  
@UristMcBobby: Might or might not be true about relation between number of lines of code and code quality. Sometimes, the answer is just simple. –  nhahtdh Jul 17 '12 at 9:02
1  
@nhahtdh: Further explanations can never hurt. –  Time Traveling Bobby Jul 17 '12 at 9:05
    
@UristMcBobby: I agree on that, though. I usually put some explanation to make sure I understand my own answer thoroughly enough. –  nhahtdh Jul 17 '12 at 9:08
1  
IMO downvote but don't recommend deletion. Often the problem is (unless you're fairly familiar with the language/specific problem) you can't improve these sort of posts on your own from the editing workflow. –  Ben Brocka Jul 17 '12 at 11:50
    
@UristMcBobby: Can you post answer covering all points you mentioned in comments. –  Somnath Muluk Jul 17 '12 at 13:49
1  
How to improve low quality answers consisting of only a code block? I have a suggestion: loyalkng.com/wp-content/uploads/2010/12/flamethrower.jpg –  Pëkka Aug 15 '12 at 16:04

2 Answers 2

up vote 14 down vote accepted
+50

It is the same process as with improving any other answer.

If you know, with confidence, what the author of the code had in mind, you can edit to explain what the code is and how the part of the code that relates to the question works.

If you don't, you can leave a comment. It should be obvious from the wording of your comment what exactly requires explanation. The author of the code will automatically be notified.

Edit: As a sister answer righfully stresses, whenever a question already has some good answers, use voting first, and also flagging or delete voting if needed. These are the right tools for pulling the best answers to the front quickly and for getting rid of duplicate or harmful content. The challenge of each question is to arrive at a good answer; not necessarily by improving a mediocre one.

share|improve this answer

Most of the time, I don't think that code only answers need to be improved.

When I'm looking through the low quality review queue and I come across a code only answer, I'll typically have a look at the question to see what other answers have been given. Usually there is at least one other answer on the question that either has the same / similar code with an explanation or has been accepted by the OP. If that's the case, I click the 'Recommend Deletion' button.

I don't see any point in ploughing extra effort into duplicate answers. If the answer does add something unique and you think an explanation would be useful, then I agree with @Jirka, in the first instance you should leave a comment to the poster to encourage them to provide the explanation.

share|improve this answer
5  
However, a "delete because it's a duplicate" option would be an improvement IMHO. –  Hugo Aug 14 '12 at 5:56
    
I agree, +1. I sometimes give answers like this (with comments to warn about clever/ugly stuff) but only if OP is not worth being given further explanation (i. e. instead of writing RTFM). –  H2CO3 Aug 15 '12 at 6:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .