7
\$\begingroup\$

A user recently posted this question which-set-of-code-is-more-accurate where they ask for a comparative review between their code and code written by a third-party, hosted on GitHub. My question is not about this post in particular.

Is it on-topic to request for a comparative review between code written by OP and third-party code?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ could you clarify what exactly you mean by third party code? It's not clear whether that refers to code hosted by a third party (GitHub) or written by a third party (but included in the question). Thanks :) \$\endgroup\$
    – Vogel612 Mod
    Commented Sep 29, 2019 at 17:41
  • 1
    \$\begingroup\$ @Vogel612 Written by third-party, hosted on GitHub. I hope the edit is clear, else ... be my guest to edit :) \$\endgroup\$
    – dfhwze
    Commented Sep 29, 2019 at 17:43
  • 4
    \$\begingroup\$ I don't have the headspace for writing out a full proper answer right now, but the specific question (as you describe it) is definitively off-topic because parts of the code under review are not presented in the question itself. That being said: We have had questions where people wanted to compare their implementation against that of a colleague and usually the community opted to not be instrumentalized for someone's personal feuds, however small they were. This should give a pretty good idea of what I'd advocate for \$\endgroup\$
    – Vogel612 Mod
    Commented Sep 29, 2019 at 19:09

1 Answer 1

12
\$\begingroup\$

Code Review only allows for reviews of code that is written/maintained by the author. We have that requirement for multiple reasons, including legal (copyright) and moral (to avoid code-shaming).

When a question asks to compare the poster's solution against some arbitrary solution found on GitHub, that is a underhanded way to ask for a review of third-party code. There is no reasonable way to say "your code is better" without implying that the third-party code is worse, and therefore it is not a fair question to ask on Code Review in the first place. Such underhanded "code review" requests should be closed based on authorship grounds, and could be made on-topic by removing all references to the third-party code.

There are circumstances where a poster asks to compare their solution against one provided by the book where the challenge was posed. That's OK, in my opinion. The book's author presumably acts as an authority, and it's OK for us to challenge that authority as part of the learning process.

\$\endgroup\$
4
  • 4
    \$\begingroup\$ "There are circumstances where a poster asks to compare their solution against one provided by the book" Considering most books have a clause in the front stating none of the material may be copied, distributed, etc., wouldn't this still be objectionable due to the legal reasons mentioned in your first paragraph? We can challenge the approach if the book is in favour of something that really shouldn't be done any more (think K&R-style C), but not the code from the book, I think. \$\endgroup\$
    – Mast Mod
    Commented Sep 30, 2019 at 6:30
  • 1
    \$\begingroup\$ It depends on what constitutes copying. Take sorting for example - the fact that a book explains a quicksort doesn't mean nobody else can use it, regardless of what the book says. So perhaps someone is comparing his own quicksort to the book's version and asking which is faster in his language. That's not off-topic, that's good advance research when asking a question, and arguably makes the question better than it would otherwise be. \$\endgroup\$
    – Gloweye
    Commented Oct 7, 2019 at 12:17
  • \$\begingroup\$ @Gloweye "which is faster" isn't really a good CR question, since the answer is "use a profiler and figure it out". \$\endgroup\$
    – Mast Mod
    Commented Oct 17, 2019 at 9:34
  • 1
    \$\begingroup\$ Then lets make it "which is better". I don't think that changes the core idea of my comment much. \$\endgroup\$
    – Gloweye
    Commented Oct 17, 2019 at 9:36

You must log in to answer this question.

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