2
\$\begingroup\$

This question of mine (10k required) was put on hold with the explanation

and further with a comment saying

This question is off-topic because it does not appear that you are seeking a review of code that you wrote yourself.

For background, my question was about a code snippet on a blog which is making the rounds right now. Given that the topic is performance, I think it's interesting that I managed to squeeze a good additional 60% from the blogger's implementation in my answer to my own question.

I see a motivation to the code ownership requirement in this policy in the linked FAQ but I would like to ask for a reassessment of this policy. I can think of a number of situations where reviewing someone else's code would be interesting and useful.

  • Textbook examples
    • Why did the book author write the code this way and not that way? Discussing and elaborating example code (within reason, i.e. given a proper understanding of the constructs etc by the OP) would seem extremely useful for learning.
  • Code critique
    • A critical review of a code snippet on a blog or in reference documentation may well help the authors of those resources, and thus eventually the greater community. Sending your own personal comments by email is not a good way to reach through, and lacks the "many eyeballs" benefit that you get from a public discussion. Referring someone to a discussion on CR.SE also adds credibility both to the site and to the cause, and furthermore invites the author of the code to participate.
  • Security reviews
    • There are arguably other forums for proper security audits, but being able to discuss alternatives to a security solution in a product you use would seem useful and important.

Finally, my apologies for breaching the policy of this site before discussing here. It simply did not occur to me that this particular use of the site would be explicitly disallowed.

\$\endgroup\$
  • \$\begingroup\$ Just mentioning here that I already saw meta.codereview.stackexchange.com/questions/2216/… and while our questions are related, it does not address my points above. \$\endgroup\$ – tripleee Jan 20 '15 at 5:14
  • \$\begingroup\$ Good points, but I agree with Jamal's answer. \$\endgroup\$ – Hosch250 Jan 20 '15 at 5:41
  • 1
    \$\begingroup\$ That question mainly refers to allowing code maintainers to post the code here, so yes, it's not related. The status-completed "stamp" indicates that that particular proposal was approved. \$\endgroup\$ – Jamal Jan 20 '15 at 5:46
6
\$\begingroup\$

As an answer to the direct question:

I see a motivation to the code ownership requirement in this policy in the linked FAQ but I would like to ask for a reassessment of this policy.

Bottom line: No.

The reasons are that:

  • In a code review the person performing the review should be able to ask: Why did you choose to do X instead of Y?

    If the code is not your code, you cannot answer that, you can, at best, speculate.

  • Code reviews can be critical, and not only does that criticism cover the code, but often also the skills of the person who wrote the code. This is not a site for evaluating and 'smearing' people who did not volunteer for that.

  • All content on Code Review is licensed with the CC-By-CA license. By posting your code here, you are licensing it as such. If the code is not yours then you have no right to be making such decisions on behalf of the actual owner.

In all, the policy is a good one, and it creates a healthy climate on this site.

\$\endgroup\$
  • \$\begingroup\$ For your third bullet point, see my comment to Jamal's answer. For your second bullet point, I don't see the relevance--your second bullet point addresses answers not questions, and answers shouldn't smear anyone, regardless of whether the original author and the original poster are one in the same. A personal attack is not an answer at all. \$\endgroup\$ – nhgrif Jan 20 '15 at 12:06
  • 1
    \$\begingroup\$ And as for your first bullet point, there are plenty of people who post their own code who don't know why they did something someway beyond "it worked", which is basically a non-answer. In fact, the less you know about why you wrote code as you did, the more likely it is that you're in need of a code review. If we cannot apply this point equally to both code I wrote and code I didn't write, then we can not use this as a reason why we do not allow code by authors other than the poster. \$\endgroup\$ – nhgrif Jan 20 '15 at 12:08
8
\$\begingroup\$

A secondary concern I had when closing the question was that it felt like you were using Code Review as your blogging platform. In particular, the repeated mentions of Hadoop and the use of the tag, despite the fact that the code ostensibly submitted for review had nothing to do with Hadoop, caused me to question your motives.

What could have been acceptable as a Code Review question was if you had posted the code from your self-answer as a question, like this:

Shell script to count chess game outcomes

Inspired by this year-old blog post by Adam Drake, which suggests that many Hadoop jobs could be more simply done as shell scripts instead, I wrote my own script to count the outcomes of many chess games by analyzing their PGN transcripts.

The relevant lines in the PGN files would look like

[Result "1-0"]
[Result "0-1"]
[Result "1/2-1/2"]

if white won, black won, or the game ended in a draw, respectively.

This script prints the total number of games analyzed, followed by the number of white wins, black wins, and draws.

find . -type f -name '*.pgn' -print0 |
xargs -0 -n4 -P4 mawk -F '[-"]' '/Result/ { ++a[$2] }
  END { print a["1"]+a["0"]+a["1/2"], a["1"], a["0"], a["1/2"] }' |
mawk '{games += $1; white += $2; black += $3; draw += $4; }
  END { print games, white, black, draw }'

As you can see, it is an implementation of the map-reduce technique, based on Adam's code.

On my quad-core Dodecapentium machine with n files on a RAID50 array, I saw x% performance increase relative to Adam's solution on his blog, which is in turn faster than Hadoop. Can anyone improve the performance even further?


The difference is:

  • The code being reviewed is your code
  • You would be seeking advice for improving what was your best attempt
  • The focus is on technical issues, without the sense of pontification
\$\endgroup\$
  • 3
    \$\begingroup\$ Thanks for the additional feedback. New attempt: codereview.stackexchange.com/questions/78086/… \$\endgroup\$ – tripleee Jan 20 '15 at 7:37
  • \$\begingroup\$ This should be marked as the accepted answer, in my opinion. \$\endgroup\$ – nhgrif Jan 20 '15 at 12:04
  • 1
    \$\begingroup\$ Moreover, this question would even still be okay if the final question was in the form of something like, "Is there anything that I've missed that would explain why Adam's solution is actually better despite being slower?" \$\endgroup\$ – nhgrif Jan 20 '15 at 12:10
7
\$\begingroup\$

Here are my reasons why I think this wouldn't work as you suggest:

Textbook examples

Are we supposed to contact the book author and tell them about these reviews? We don't just review any code given to us. We help to improve your own code, not just any code you find somewhere. As for seeking understanding of code, you can post it on Stack Overflow. But don't expect a review from them since that's off-topic there altogether. You may also provide an implementation based on some textbook code and submit that for review, while quoting the original code.

Code critique

If you think someone else could benefit from a code review, you're absolutely welcome to invite them here and have them post it. Posting their code anyway will bind it to the CC-BY-SA license, and it cannot be removed from this site for good unless a takedown request is given to SE. Although the community shouldn't be concerned with legal matters, the mods may still receive flags about this and may not be able to act on them. If the question already contains upvoted answers, and the author comes by and requests to have the code removed, it may be refused. That'll just lead to frustration, especially if the community also gets involved (if the dispute takes place outside moderator flags). Restricting questions to only the asker's code (owned or maintained) helps minimize these issues.

Security reviews

If by "product you use" you mean someone else's product, then no. Again, you're forcing someone else's code into this license, and they may not like that at all. Security by itself would be a bigger issue, and it may just lead to ugliness, especially if the code happens to be very sensitive.


Furthermore, it may benefit you to spend more time on our site before you recommend a drastic change to such a significant policy. This may not have been around since the site's creation, but there are good reasons why they were eventually established. Other than the licensing issues, we just prefer to review code written or maintained by the author. Even better, we get to communicate with the author and feel happy when we're told that we've helped them improve their coding. That's why we're here.

What do we get out of reviewing someone else's code? Just rep, pretty much. Either the author will never see these reviews, or he/she will just want it all removed for good. There's just no real benefit to allowing something like this.

\$\endgroup\$

You must log in to answer this question.

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