2

Simple idea/question:

Should or could we make a minimal working example a prerequisite?

Like it e.g. is common in the LaTeX world/community. It surely isn't the same for our area, but to generalize it, I personally would say, provide a working example of code with your question. If possible of course and in contrast to some not self-sufficient, ergo not working example, code snippet. It probably isn't realistic - short-term at least - to make it a prerequisite, but it would make some sense - in my honest opinion at least - to start promoting such an approach.

| |
  • This seems like it's kind of already required, at least to not be qualified as a low-quality / too broad question, as an unspoken rule. If we enforced something like this, wouldn't it dissuade people from asking questions that need explanation or clarification on a certain aspect of WordPress? ex1, ex2 – Howdy_McGee Feb 11 '16 at 14:59
  • 1
    I guess you are kind of right, but often enough you have the situation that people ask questions about their working code, but do not provide a working example of that code. Those are the kind of questions this suggestion is aiming towards. Of course it shouldn't be a necessity for all kinds of questions, because, as you rightfully noted, there kinds of questions where a MWE just can't be provided, due to their nature. But if possible, then I just want to say, please provide a MWE, thanks. So I guess, I just want to make it a thing, to have it easier later on. I'm kind of lazy... @Howdy_McGee – Nicolai Feb 11 '16 at 15:19
5

Essentially there are two cases with code:

  1. Code with issue that can be only spotted by running — this would take all of it.
  2. Code with issue that can be easily spotted by eyes — this would need as little of it as possible.

These are mutually exclusive. I often just skip question with too much code because reading code is hard and takes time.

Overall there needs to be appropriate amount and manner of code in the question. This is subjective and individual to a question, which falls under existing voting and commenting mechanisms.

| |
  • I often just skip question with too much code +1 on that. – Pieter Goosen Feb 12 '16 at 10:24
  • That skip too much code part could result in an edit… – kaiser Feb 12 '16 at 11:40
  • Thanks, too you both. Unfortunately I haven't had the time for a discussion, got somehow unexpectedly busy. Both answers are on point, I'm accepting this one, because it is pretty much the minimal working answer in this case. @kaiser – Nicolai Feb 17 '16 at 18:25
3

TL;DR No, I would not make this a requirement.

For the actual why for this no, there's a quite simple reason: In lots of cases people don't know why there code is not working, hence they ask the question. That means: Commenting, asking questions, editing the question, editing answers, rinse … repeat.

Forcing working code examples could be something that we need for answers, as there is too often some very broad and general answer that could easily be written out in code – for what some people are just too lazy. The downside of this – and this is why I would vote no for that one as well – is that this would encourage a lot of people again to outsource their work to this site, a situation that we had for a long time with some users. It would also narrow down the answer to one single problem and de-generalize some answers which would maybe even make it less helpful for later readers. Remember that we discourage adding code without explanation already.

The rule of thumb for a good question is:

  1. Explain your problem, your expectation and the the outcome, the best you can
  2. Show what you have tried
  3. Outline where you are stuck, add proper debugging, error messages, broken parts
  4. Edit the question and show your progress

The rule of thumb for a good answer is:

  1. Explain where you see or expect the problem to be
  2. Outline how to solve it
  3. Show how you go down the rabbit hole
  4. Write it as general as possible to catch as many related use cases as possible

Nowhere in both scenarios I can see code an absolute necessity.

Also, as this site is not only about application development, but about site and server administration as well, I have a hard time to imagine how people would show a minimal working code examples for problems with for e.g. WordPress install with a Redis Drop-in, powering cache behind an nginx reverse proxy that responds slowly for one of three Lighttpd upstream servers, but works well in a local VVV-Vagrant development setup.

| |

You must log in to answer this question.

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