16
\$\begingroup\$

I skipped reviewing this answer because I am not sure what to do with it after I read the comment posted below it:

Welcome to Code Review! You have presented an alternative solution, but haven't reviewed the code. Please explain your reasoning (how your solution works and why it is better than the original) so that the author and other readers can learn from your thought process.

C# is not my field of competence, but I am interested in that bold statement: why are alternative solutions not welcome here? Is providing an alternative solution really a bad thing? Don't alternative ways of thinking and approaches present improvements? I ask this because I want to understand the policy of this website.

\$\endgroup\$
32
\$\begingroup\$

The site's name is Code Review for a reason. We review the code in question by pointing out mistakes, bugs, edge cases with an explanation. Just dumping some alternative implementation without any explanation why the code is better is not reviewing the posted code.

We expect the answerer to explain why something is done in the way it is done. Otherwise there wouldn't be a learning experience for the asker.

Some references about good answers:

Checklist or general directions on how to write a good CR-ish answer

How much can an answer be subject to opinion?

Justify your review!

Text minimum in questions

\$\endgroup\$
15
\$\begingroup\$

Why are alternative solutions not welcome?

They are. Note the text:

You have presented an alternative solution, but haven't reviewed the code.

The problem is not that it shows an alternative solution but that it doesn't review the code. Every answer should make at least one observation about the code posted in the question.

To help explain what that means, there is the next sentence.

Please explain your reasoning (how your solution works and why it is better than the original) so that the author and other readers can learn from your thought process.

The "why it is better than the original" can be the one observation about the original code.

If you think that a revised wording of the message would make this clearer, you are welcome to propose one.

We like answers that propose alternative solutions. We especially like them if they are nifty ones that we might use for something someday. What we don't want to see is the asker being buried in alternatives without any guidance as to what makes them better. This is frustrating for the asker and can lead to problems. Some alternative solutions are specific to particular conditions of the problem.

Another problem is that an alternative solution may not be better. If you can't explain why an alternative solution is better than the original, then maybe it isn't.

In that particular case, note that it wasn't actually an alternative solution. It was part of an alternative solution. That would have been much more obvious with some added explanation for context.

\$\endgroup\$
  • 10
    \$\begingroup\$ Just to be explicit: alternative implementations with explanation but without remarks about the original code are still unwelcome. \$\endgroup\$ – Mast Aug 14 '17 at 8:27

You must log in to answer this question.

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