Lately, I've seen a lot of "this is my code, please find the bug" questions, i.e., people just dump their complete class file instead of creating a minimal working example.

When I see this, I usually leave a comment, pointing them to http://sscce.org or explaining how to create such an example (sometimes in vain, sometimes people actually go ahead and shorten their code a little bit).

Would it make sense to do something against this problem? For example, issue a warning when a new user tries to enter more the 20 lines of code, providing some hints on how to create a "good code sample"?

EDIT: It looks like a feature has been added to address this issue:

How do you prevent "Here code. You fix." questions?

  • 5
    Are you kidding? We're often lucky to get any code at all! – Grant Thomas Apr 26 '11 at 14:13
  • 5
    @Mr. Disappointment: Well, that's another problem (with the same cause: people not investing time in creating a good question). – Heinzi Apr 26 '11 at 15:02
  • 2
    Hmm, close votes seem like a good way to discourage this. We've got 50 of them now, thankfully I don't run out as quickly anymore. – Cody Gray Apr 27 '11 at 0:37
  • Hello, I have been writing a code to represent MATLAB Cell Arrays in C and the code is working. But I would like an experienced coder to comment on the implementation, whether it may lead to problems in future, etc. How do I post a question about this on Stackoverflow? – mod0 Feb 25 '12 at 21:57
  • @MaheshNarayanamurthi: Have a look at codereview.stackexchange.com – Heinzi Feb 25 '12 at 22:51

In the same way we show a red box that tells people their question is likely subjective and may get closed, it seems that adding a similar box on a code dump would help:

"Questions with large blocks of code typically get fewer good answers than questions which show the smallest portion of code that still generates the error. Consider following these suggestions."

Although it would be better to link to a meta question which gives essentially the same info, but targeted to the SO audience.

  • 2
    I'm not convinced the cure isn't worse than the disease. This could lead to more questions where the only possible answer is “show us the code”. – Gilles 'SO- stop being evil' Apr 27 '11 at 22:52
  • @Gilles True. On the other hand, the act of trying to explain the problem, rather than showing a large code block, sometimes makes one understand the problem and resolve it on their own. But I guess it's a toss-up. Which is worse - large code blocks which are essentially too long to read, nevermind debug, or questions with no code example? – Pollyanna Apr 28 '11 at 3:22

Warnings were made to be ignored. Most users barely take the time to format their posts, they can't even be bothered to use a spell checker. Adding even more documentation and warnings will achieve nothing.

You must log in to answer this question.

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