Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

How do I write a good answer?

Thank you for taking the time to contribute an answer. It’s because of helpful peers like yourself that we’re able to learn together as a community. Here are a few tips on how to make your answer great.

What goes into an answer

Every answer must make at least one insightful observation about the code in the question. Answers that merely provide an alternate solution with no explanation or justification do not constitute valid Code Review answers and may be deleted. In addition to criticisms, pointing out good practices in the code is also a form of helpful feedback.

Answers need not cover every issue in every line of the code. Short answers are acceptable, as long as you explain your reasoning. Do not provide suggestions for improvements in a comment, even if your suggestion makes a very short answer.

Before answering

Not all questions can or should be answered here. Save yourself some frustration by flagging off-topic questions for closure instead. Also, if a question is ambiguous, it may be better to write a comment asking for clarification rather than writing an answer based on an incorrect assumption.

Read the other answers so you don't cover duplicate points. While it is fine to mention points in multiple answers, each answer should contain at least one novel observation.

Organizing your thoughts helps make your answer more readable by grouping related points together.

Tailor your advice to the apparent level of the author of the question, because our goal is to help programmers learn to improve.

Write to the best of your ability

We don't expect every answer to be perfect, but answers with correct spelling, punctuation, and grammar are easier to read and tend to get upvoted more frequently. Remember, you can always go back at any time and edit your answer to improve it.

Always be polite and have fun

It’s fine to disagree and express concern, but please be civil. There is a real human being on the other end of that network connection, however misguided they may appear to be. We are here to learn from our peers, not to yell at each other.