27
\$\begingroup\$

This question already has an answer here:

I think it would be a good idea to compile a list of guidelines on how to ask good question. What information should be present, how to structure it, etc.

\$\endgroup\$

marked as duplicate by 200_success Jul 21 '15 at 3:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

32
\$\begingroup\$

In my mind the perfect question looks like this:

The question should start with an explanation of the problem the code is trying to solve. Possibly accompanied by unit test and/or a formal specification, though I imagine an informal description will suffice in most cases.

After that comes the code. The code should be properly formatted and, unless it's a very small and easily understandable snippet, thoroughly commented.

Then the question should explain which design decisions were made in the code and why. This may not be necessary for all questions. Also it may be done in comments in the code instead of separately if it's not too long.

Lastly the asker should explain which aspect (if any) of the code he feels unsure about and in which area he's looking for improvements. This might be as general as "I think this code is okay, but I'd feel more secure after getting second opinions from the community", but I think some indication of what the asker's expectations are will be helpful in answering the question satisfyingly.

\$\endgroup\$

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