219
\$\begingroup\$

You're on Stack Overflow and you've found a question that seems to be about improving code. You are trying to be helpful, and you put a comment in the question:

You should try asking on CodeReview.SE instead. —YourName 2 minutes ago

… and suddenly, out of nowhere CodeReview.SE users swoop in saying:

@YourName No, this isn't a good question for Code Review. —AnotherName 5 seconds ago

or they might say:

@YourName This could be a good question for Code Review, if (…) —AnotherName 5 seconds ago

Why are they saying that this isn't a good question, as it is, for Code Review? What is in scope on Code Review?

What should I look for when determining if a question should go on Code Review? And why do they sometimes seem to get so annoyed about the referral?

This question is Code Review's version of a similar question on Software Engineering Meta.

\$\endgroup\$
0

1 Answer 1

207
\$\begingroup\$

What distinguishes Code Review from Stack Overflow?

Different communities have different rules to address different needs. A quick summary:

Code Review Stack Overflow
Open-ended questions 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, Foo/Bar, or 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?

\$\endgroup\$
11
  • 3
    \$\begingroup\$ "Code must work as intended | (No such requirement)" -- If anything, the opposite requirement. In general, if you have working code on Stack Overflow, you're doing something wrong. \$\endgroup\$
    – Nic
    Commented Oct 19, 2016 at 2:39
  • 4
    \$\begingroup\$ "Questions asking 'Does this code work?' or 'Is this correct?'" are off-topic on Stack Overflow too as they're a variant of "gimme teh codez" (or, in this case, "gimme teh test casez"), so these should just be downvoted and closed outright. As the tooltip for downvotes says, these questions "do not show any research effort; they are not clear or not useful." It's the OP's responsibility to test their code prior to posting, not to just dump it on the community and ask us to test it for them. \$\endgroup\$ Commented Apr 21, 2017 at 15:30
  • \$\begingroup\$ How do you actually flag for migration from SO to CR? Via custom moderator flag? \$\endgroup\$
    – PM 77-1
    Commented Apr 25, 2017 at 13:57
  • 1
    \$\begingroup\$ "The Stack Overflow Help Center doesn't say that code reviews are explicitly off-topic there." The code-review tag now says that code reviews are generally off-topic there: Remove the [code-review] tag \$\endgroup\$
    – user135216
    Commented Oct 14, 2017 at 16:55
  • \$\begingroup\$ "GUI is misleading" link broken. \$\endgroup\$
    – kingsfoil
    Commented Mar 14, 2018 at 17:29
  • 1
    \$\begingroup\$ This answer look rude to me. I feel patronizing. (But I agree) \$\endgroup\$
    – Stargateur
    Commented Apr 14, 2018 at 15:08
  • 2
    \$\begingroup\$ @Stargateur And your comment exemplifies why the "welcoming" blog is nonsense. The answer is merely stern. \$\endgroup\$
    – jpmc26
    Commented May 7, 2018 at 23:52
  • \$\begingroup\$ Shameless self-promotion alert, but I have a Meta post on why "is this correct?" is OT: Why is “Is this correct?” an off topic question, and what should I ask instead? \$\endgroup\$ Commented Oct 4, 2018 at 4:01
  • \$\begingroup\$ @PM77-1 Yes it seems it is recommended that you flag for moderator intervention with a reason why you believe the migration would be useful. \$\endgroup\$ Commented Dec 7, 2018 at 19:27
  • \$\begingroup\$ I am missing an explicit statement about whether a question can be too broad here on this site or not (the closest is "not all code review requests are on-topic on Code Review."). E.g., is it perfectly OK to post some working code and just ask "What do you think about this code?" \$\endgroup\$ Commented Nov 18, 2019 at 23:06
  • \$\begingroup\$ @PeterMortensen In the future posting a question, not comment, may get you a quicker response. "whether a question can be too broad"; for the most part a question can't be too broad. Your example is how all questions can be interpreted. Even if you ask "can I improve my code in x way" by posting you allow reviews of all aspects of your code. I don't think I've ever seen "too broad" used on Code Review. \$\endgroup\$
    – Peilonrayz Mod
    Commented Mar 31, 2021 at 18:52

You must log in to answer this question.

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