What distinguishes Code Review from Stack Overflow?
Different communities have different rules to address different needs. A quick summary:
||Questions with a specific goal
|Answers can suggest any improvement
||Must answer the question
|Code must already work as intended
||(No such requirement)
|Prefers code in its “native habitat”
||Prefers distilled examples
|Code in question must be preserved verbatim
||Readability edits allowed
What are the most important considerations?
- Before referring a Stack Overflow user to Code Review, consider: Is it really off-topic for Stack Overflow? Just because a question is said to have "working code" and seems to be on-topic on Code Review, doesn't mean that it is automatically off-topic for Stack Overflow. There are many questions that are on-topic on both sites. The Stack Overflow Help Center doesn't say that code reviews are explicitly off-topic there, so don't migrate for the sake of migration.
- Before posting a question on Code Review, read How do I ask a good question?, which covers the common reasons for questions being poorly received on Code Review.
Does the question title need to be changed?
Question titles for Stack Overflow are questions targeted towards achieving a specific outcome (e.g. Can I make this algorithm more time/memory efficient?), whereas all questions on Code Review have a single, implicit, general question, "What can be improved in this code?". So it's not useful for every question to be titled using some variant of "Please review my code", and the site standard is for the title to contain a summary description of the real-world problem that is solved by the posted code.
Complete advice in writing titles is in How to get the best value out of Code Review - When you ask your question.
Some commonly referred inappropriate questions
Please, we don't want the following kinds of questions: they will attract downvotes or close votes on Code Review, leading to frustration for everyone involved.
Questions where the code does not work as intended, or it's unclear whether or not it works
The most common reason for questions to be closed as off-topic on Code Review is that the code simply does not do what it is meant to do. Code Review is not about fixing bugs, and it is not a place to go for help adding a new feature to your program.
Questions asking "Does this code work?" or "Is this correct?" should be tested before being posted here. You should believe that your code works before you ask for a Code Review. There is a difference between asking "Does this code work?" (off-topic) and "This code works, how can I do it better?" (on-topic)
Questions with stub code, example code or pseudocode
Code that contains placeholders such as
// do something,
someMethod() cannot be meaningfully reviewed. Hypothetical example code is off-topic for Code Review.
Unlike Stack Overflow, we prefer to look at real, complete code instead of example code or code that has been stripped of context for generality.
Questions with no code at all
Without code embedded directly within the question, we just cannot do a Code Review. We review Code and not unimplemented concepts.
If it seems like a question would belong on Code Review if the OP included their actual code, it is extremely important to point out that they need to include the code in their question.
Questions with insufficient context
A question that does not describe properly what the code does, while not immediately off-topic, is very likely to collect down-votes. To help reviewers give you better answers, Code Review questions should include a description of what the code does. The more you tell us about what your code does and the purpose of it, the easier it will be for reviewers to help you.
So what questions do you want?
- Finished, working code that does what it is meant to do
- Ideally, an asker willing to receive feedback on any aspect of the code
On all cross-posted questions, please add comments with mutual links. This helps everyone save time when triaging and answering questions.
So, why so upset?
Good referrals are genuinely appreciated. However, an inappropriate referral causes grief for everyone involved:
- The original asker, cross-posting the question on Code Review, becomes puzzled or unhappy about receiving close votes or downvotes.
- The close votes or downvotes make the Code Review community look hostile, when we are just doing our duty to inform the poster that the question is unanswerable.
- The original asker may become frustrated that Code Review answers are "missing the point of the question", because on Code Review all questions are considered to be open-ended.
- Stack Overflow looks unhelpful for giving someone the runaround instead of answering the question.
- As long as we receive a significant number of inappropriate referrals, we cannot consider making Code Review a standard migration target on Stack Overflow.
Code Review has a much smaller community than Stack Overflow. We get about 30-40 questions per day. Stack Overflow gets about 8k questions per day. Even if a small fraction of Stack Overflow questions ends up being inappropriate referrals, the effort required to undo the damage imposes a large burden on the Code Review community.
What you should not do
Please do not vote to close with a custom reason that "it belongs on Code Review". Nothing in the Stack Overflow rules justifies such a custom reason, and sloppy reasoning perpetuates inappropriate referrals. Not all questions about analyzing code are off-topic on Stack Overflow, and not all code review requests are on-topic on Code Review. Instead, vote to close as too broad or primarily opinion-based.
We know that the GUI is misleading and we would like to do something about this. There are many occurrences of a Stack Overflow moderator saying the same thing. There is an active proposal to create a dedicated off-topic reason so that there is an intuitive process to close code review questions on Stack Overflow.
So, what can you do?