The format that I know for question bodies is:

Intro, often explaining where the problem originated.

A problem statement explaining what the code is supposed to do.

Perhaps a little more context or explanation about the code, possibly including how the problem is to be solved, e.g. a sorting problem might be solved by quicksort or bubble sort.

File.name

The code itself.

Any further thoughts on the code, particularly questions that the author is considering.


However, in this question, the question was edited so that the "further thoughts" section is now between the problem statement and code rather than after the code. This is problematic since that section is referring to the code in such a way as to suggest that someone should have read it by then.

There are several problems with the question that I would like to fix:

  • I'd move the "further thoughts" section back to the bottom.
  • Remove "(beginner)" from the title and add .
  • Remove "Thank you." from the migrated text.

But rather than start an edit war, I figured I'd seek consensus before reverting the previous change.

  • 1
    How about: Asking Questions or Simon's Guide? – rolfl Aug 10 at 2:24
  • 2
    That seems to imply that all the text should be above all the code, even though that doesn't match, say, this question or this question. – mdfst13 Aug 10 at 5:23
  • I have re-edited to move your text back where it was. I thought it would be easier to read with all the text at the top, but I've been wrong many times before and this may be another time. Sorry about that. – Phrancis Aug 10 at 6:19

Honestly, as long as it's all there, I don't mind the order of things. Especially if headers or other methods of formatting are properly used to keep it all tidy.

Questions should contain a problem statement, code and a bit of an explanation. The problem statement should be up front for best readability, IMO. The other two, there's pros and cons to either coming second and the other third.

If the code comes before the explanation, the explanation makes more sense. If the explanation comes before the code, the code makes more sense.

So, does the order matter? Not for me. Just read the entire question twice. With most questions I got to do that anyway to make sure I didn't miss anything important.

What we really shouldn't do, is enforce a specific order. Posting on Code Review is complicated enough for new users so let's not make it more complicated by enforcing something that simply doesn't matter much in the grand scheme of things.

I agree with your list of items that should be in a question. I agree with the problem statement coming first. A filename above the code is helpful the moment multiple files are used. Afar from that, I don't see a reason to mind the order much.

There is one scenario where I think it makes sense to move the problem statement to the top. If a question starts with code and the description is below it. In this case such a question simply looks weird on the question page because it doesn't have any description but an ellipsis ... like this one:

Cropped screenshot showing question from a list page

...unless it was intentional but I doubt it.

  • 2
    That doesn't really apply here, as the problem statement was at the top in both versions. It was the section, "The questions that I have about my coding choices are..." that was moved from the bottom to the top. That said, I think that we are all in agreement that there should be a problem statement, and it should be at the top. And this is one of the reasons why. – mdfst13 Aug 11 at 3:14

You must log in to answer this question.

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