22
\$\begingroup\$

I came across this question today:

Count the ways to partition an array into two equal sets

This question can be interpreted in a way, that it asks for a complete rewrite of the code, and indeed some of the answerers do that.

My question is:

  • Is a question that asks for a complete rewrite of a piece of code is acceptable in Code Review.SE?
  • If a question does not asks for that (or even if it does), are answers that suggest complete rewrite of the code acceptabe?
\$\endgroup\$

1 Answer 1

23
\$\begingroup\$

For the record, the linked question asks:

Is there any better way to do this?

I believe that is the question we all want the answer to when posting code here, more or less.

Is a question that asks for a complete rewrite of a piece of code is acceptable in Code Review.SE?

It depends on how it is asked.

If you ask "Can someone please rewrite this code for me?" that is likely to be downvoted.

If you ask "Can this be done in a different way?", then yes that is acceptable.

Are answers that suggest complete rewrite of the code acceptable?

Yes. Always. But not a code-only "Here is how I would do it" answer.


Note that a question asked: "Can this be done in a different way" does not require any code in the answer. A hint, description, alternative algorithm can be suggested as "words", not as "code". Which makes it a code review request, not a "gimme-tez-code"

\$\endgroup\$
0

You must log in to answer this question.

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