I've noticed some questions, like the following, come up:

These questions aren't really looking for a code review. Instead, they are asking a specific question about a code snippet. Should these questions be on-topic?

I brought up this subject before in Practical Best Practice Questions. While there wasn't much in the way of response, the two votes were to consider these questions on-topic. However, people are now voting to close them. As a community, we should come to a consensus about what we want to do.

Should we strictly allow code review questions, allow anything in the broad range of style/performance of code questions?

  • 1
    \$\begingroup\$ How about adding your person opinion about these questions? We won't have much response here otherwise. \$\endgroup\$ – Aseem Bansal Aug 24 '13 at 12:14
  • 2
    \$\begingroup\$ @AseemBansal, I'm a little hesitant to offer an opinion because I'm concerned that as a moderator some will take my word as law rather then just a view-point in the discussion. In determining community consensus on this issue, my view has no more weight then anyone elses. \$\endgroup\$ – Winston Ewert Aug 24 '13 at 14:52
  • \$\begingroup\$ @WinstonEwert: Good point. Now, do you have a "deadline" for receiving responses before making a decision? Or will you still wait for additional responses? Right now my answer has three upvotes... so I assume that means four yeses for this decision so far. \$\endgroup\$ – Jamal Aug 25 '13 at 5:49
  • 1
    \$\begingroup\$ @Jamal, there would seem to be consensus agreeing with your answer. Consider it official policy. \$\endgroup\$ – Winston Ewert Aug 26 '13 at 16:10
  • 1
    \$\begingroup\$ I asked this question on main meta. It might be useful for people to keep an eye on that question as some people seem to be against that policy. \$\endgroup\$ – Aseem Bansal Aug 27 '13 at 16:37
  • 1
    \$\begingroup\$ @AseemBansal, I've unaccepted the answer, and marked the question as featured. I'll wait to give more chance for discussion before taking further action. \$\endgroup\$ – Winston Ewert Aug 27 '13 at 20:35
  • \$\begingroup\$ @WinstonEwert: That's alright (and I do prefer this). \$\endgroup\$ – Jamal Aug 27 '13 at 20:46

Thank you for bringing this up. I've felt some hesitations at times, not knowing if something really is off-topic or not. Although I've never minded being corrected on making bad calls, I agree that we should come to a consensus.

Okay, we know that only working code is allowed here; that is, code without errors and/or other "fatal" execution flaws. We also review "non-execution-preventing" issues such as slow performance, security holes, poor design, and less-than-stellar practice. I think that's pretty clear-cut. Now, as you specify, the problem is what can be reviewed based on where the code is coming from and/or its relevance (project, example, another website, etc).

Although we currently only prefer project code, there have been numerous questions strictly about example code, but which also pass the "on-topic tests." Clearly, as the high number of upvotes and complete absence of downvotes show, no one gave a care that it wasn't from project code. Do I agree with them? As a matter of fact, I do. I've also upvoted that question. Why? Because I've found it helpful. Beyond that, 1.) the other voters seem to have found it helpful, and 2.) it passes the "on-topic tests." Lastly, and more importantly: visitors may find it helpful.

Okay, so it's just one (popular) question, but it's enough to convince me that even example code should be allowed as long as it passes the on-topic tests. As such, I don't think "project-only" should be part of the test. Who knows? Perhaps it's not all purely example. It may just be something the OP wants to clarify before applying the concept to project code.

  • 1
    \$\begingroup\$ I like you're argument, because sometimes, when I am writing out code, I cut out parts that are sensitive in nature, like email/names/etc, or as you said, I am testing a proof of concept before I actually implement it. In that case, the code would be very much like "sample code" so the "project-only test" would be very limiting in that manner. \$\endgroup\$ – Ben Schwabe Sep 2 '13 at 23:55
  • \$\begingroup\$ What are the on-topic tests, again? \$\endgroup\$ – Big McLargeHuge Feb 19 '14 at 19:20
  • \$\begingroup\$ @davidkennedy85: 1.) the code is free of noticeable errors, 2.) the code is embedded and is not just behind a link, 3.) new code is not being requested, and 4.) the code belongs to you. \$\endgroup\$ – Jamal Feb 19 '14 at 19:25
  • \$\begingroup\$ @davidkennedy85: Now, this argument is kinda old, and I wasn't asserting that pure example code should now be allowed (hence why I locked the linked question). Instead, the code should relate some way to a project, one indication being "actual" names for variables/functions and not example names "such as "var1" or "func"). \$\endgroup\$ – Jamal Feb 19 '14 at 19:27
  • \$\begingroup\$ This answer goes a little against the fact that the specific linked question is locked since six months ago (4 months after this answer was written) \$\endgroup\$ – Simon Forsberg Jun 17 '14 at 23:28
  • \$\begingroup\$ @SimonAndréForsberg: Part of that is because this never officially became policy. Also, my views have changed sometime after posting this answer. \$\endgroup\$ – Jamal Jun 17 '14 at 23:47

Instead of thinking that they are style/performance questions how about seeing that they are actually "review of style", "review of performance" questions? They may be asking for reviews indirectly or for a particular type of review but they are review requests nonetheless. They are on-topic.

  • \$\begingroup\$ Yes, asking for a particular type of review is not off-topic. However, the questions he's linked are each about something else. First one: understanding another code snippet with his own (but not asking for a review on it). Second one: asking about how to introduce new functionality (asking for code to be written). Third one: Not asking for a review, but which snippet is better. \$\endgroup\$ – Jamal Aug 23 '13 at 7:38
  • \$\begingroup\$ The first one asks for why the particular style was used. Essentially if the code style had something better than the easier 2nd style. The OP knew what the code did otherwise he wouldn't be able to translate it into the 2nd version. So he indirectly asked for a review of style. \$\endgroup\$ – Aseem Bansal Aug 23 '13 at 7:44
  • \$\begingroup\$ For second and third you are correct. \$\endgroup\$ – Aseem Bansal Aug 23 '13 at 7:47
  • \$\begingroup\$ Then, perhaps the way the question is worded confuses me. You raise some good points, but that post is one vote short of closing. That means that others are hesitant about the question. So, it's a good thing we're discussing this now. We just need others to join in. \$\endgroup\$ – Jamal Aug 23 '13 at 7:48
  • \$\begingroup\$ The question's wording is confusing. I considered voting to close but @Bakuriu 's comment made me rethink. After reading it twice I realized that it was indirectly a code review. How about @ more people to see this thread? I just did one. You can probably think of more people. \$\endgroup\$ – Aseem Bansal Aug 23 '13 at 7:52
  • \$\begingroup\$ "Indirectly a code review" is still a problem because it could be easy for some to consider it off-topic. Although it really could be a code review, it's just not direct enough for me with the current wording. Anyway, I'll go ahead and do that. @Lstor, any input? \$\endgroup\$ – Jamal Aug 23 '13 at 7:56
  • \$\begingroup\$ In that case it seems to be a big problem this can be made a close reason with certain modifications. \$\endgroup\$ – Aseem Bansal Aug 23 '13 at 7:59

You must log in to answer this question.

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