4

More and more recently, I have noticed that people aren't posing only the relevant portion of their code, but their entire project code on the question they are asking. Even though it is included in the "How to Ask A Good Question" not to do that (See below).

This is a snippet from "How to Ask A Good Question"

Help others reproduce the problem. Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire program!

I know there is a warning if an entire post is code.

Does anyone else agree that there should be a warning upon including too much code? I feel like it deters people from answering questions and is just annoying when trying to answer a question.

I know a lot of code is sometimes necessary, but most of the time it isn't needed.

9
  • 4
    I just use an auto-comment to let people know that the post is not Minimal when I feel it necessary; I'm not sure there's any decent heuristic that SO can use for this. Commented Oct 8, 2015 at 3:34
  • 2
    Just downvote and close as "no MCVE". Or if you are feeling generous because the rest of the question looks acceptable, edit. On further consideration, both are difficult without more rep... Commented Oct 8, 2015 at 3:56
  • What does "no MCVE" stand for? Commented Oct 8, 2015 at 4:21
  • 3
    Minimal Complete Verifiable Example -- stackoverflow.com/help/mcve
    – CollinD
    Commented Oct 8, 2015 at 4:29
  • 6
    How much code is "too much code"? Unless you provide the criteria, currently it's too subjective.
    – Andrew T.
    Commented Oct 8, 2015 at 4:59
  • @AndrewT. With 3.2K rep on SO, I would hope you know what I mean. Commented Oct 8, 2015 at 5:03
  • 5
    I know what you mean, but currently it's too vague. Most of the time you just need to explain the problem clearly, but the underlying code can be as twice as long as the problem description, is that too much? Or did you mean if 70% or more of the post is code? Or if the code exceeds 10k characters? You haven't provided the criteria yet, so I can't judge if the request is OK or not.
    – Andrew T.
    Commented Oct 8, 2015 at 5:12
  • While you can perhaps make assumptions about ratio of code-vs-text & provide a warning (but not block if user again hits submit button after 3sec timeout when warning appears). The problem then though is that questions arnt all the same, and often short and to the point is essential, as is sharing the entire class file to rule out other potential issues & clarify the problem is where they said it is. ALSO some people (not many) use well commented code that includes part of thier question - i do that ALOT for github (jsfiddle), though perhaps less here but frankly i mostly answer here, not ask Commented Oct 8, 2015 at 6:20
  • @AndrewT.: I basically posted that as an answer. I should read the comments before answering, next time xD
    – Cerbrus
    Commented Oct 8, 2015 at 6:36

1 Answer 1

8

"there should be a warning upon including too much code"

How should that be measured?

Should that be judged by the amount of characters formatted as inline code and / or in code blocks? Should it count the amount of lines containing code? A percentage of the post, perhaps?

With those metrics, how much is "too much"?

A well written question can be quite long, exploring multiple different attempts at solving the solution.

A limitation like this will result in users posting unformatted code in their questions. Warnings are often simply ignored.

For these reasons, I think it's a bad idea to place a hard limit, or even a warning on the amount of code that can be posted.

3
  • 1
    A hard limit has not been proposed. All that was suggested was a polite warning, I guess much like the one you get when you enter the SQL tag. As I understand it it would not prevent anyone from posting, just encouraging them from reevaluating if they fulfill the M part of MCVE.
    – Anders
    Commented Oct 8, 2015 at 7:40
  • @Anders: edited my answer a bit.
    – Cerbrus
    Commented Oct 8, 2015 at 7:45
  • 2
    I agree with this answer; the goal is to get a minimal example that demonstrates the problem, with the emphasis on the italic part. Minimal does not imply "small", if the site starts to warn about the length of code, you risk people giving up the part where the code is actually useful for demonstration purposes. I always liked SO's version of a minimal example, because minimal does not imply "short" or any specific length.
    – Gimby
    Commented Oct 8, 2015 at 9:24

You must log in to answer this question.

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