10
\$\begingroup\$

So, this question was initially triggered by disagreements over whether this question (pre-edit) was on-topic or not.

But this is a wider question, about where the line should be drawn between Reviewing Code, and Validating Code (which is what the question seemed (to some) to be asking for). Is it okay for OPs to ask us to check their interpretation of their own code?

In particular, the controversial sentence was:

So I am wondering if I am correct about this (comments are mine)

Is it okay for a question to ask for Code Validation as opposed to a Code Review?

Where do we draw the line between

these are things I think are wrong/could be improved in my code

and

Does my code work the way I think it does?

and

Is my code working/ How does my code work?

The first is obviously On-Topic, the last is obviously Off-Topic, but what about that grey area in the middle?

\$\endgroup\$
  • 4
    \$\begingroup\$ Code Validation sounds like you want to check whether code is working or not. That's off-topic. Did you mean something else? \$\endgroup\$ – Mast Sep 3 '15 at 16:51
  • 2
    \$\begingroup\$ The SO answer (Jon Skeet, no less) OP linked to seems to suggest this is generated source code... so I think the question has now become when does the OP wants to clarify generated source code? Does that make a difference? \$\endgroup\$ – h.j.k. Sep 4 '15 at 2:12
12
\$\begingroup\$

I have implemented this sorting algorithm, I believe it's \$O(n)\$, I'm wondering if someone could confirm that.

We've had tons of such "validation requests", and they've never been a problem. The question you linked to was essentially saying:

I have this code where I think I've identified a redundant null check, I'm wondering if someone could confirm that.

I don't see what the big deal is, nor how it's seeking an explanation of the code any more than the guy who's asking for a Big-O analysis.

\$\endgroup\$
10
\$\begingroup\$

(Note, personal hat. Not speaking as an authoritative source)

So I am wondering if I am correct about this (comments are mine)

In this particular case, the OP had made comments of legacy code he has to maintain and wanted to be sure that he was right. He had made sort of a review of the legacy code, and wanted to be sure he had made a correct review of it. Perfectly fine.

these are things I think are wrong/could be improved in my code

Also fine. Close enough to the point above. You have sort of made your own review already and want to be sure your review is correct.

Does my code work the way I think it does?

Here is where it's getting to the grey area. I can't judge any question based on this line alone. I would have to see more of the question. I feel this can be both off-topic, and on-topic.

Is my code working?

I would first of all comment and ask: Did you test it? What do you think, does it work? If they didn't test it, then we only risk wasting time by trying to review it. Always test your code before you post it for review.

\$\endgroup\$
8
\$\begingroup\$

Every question, by default, is looking for "code validation" (does the code do what it is supposed to do?)

In addition, every question is looking for a review of "any and all aspects of the code" with a particular focus on any aspects the user may have special concerns for.

In other words, if there's code, the "default question" is: What do you think of my code? and in this particular question it is:

What do you think of my code, and am I right that the null-check is redundant?

I see that as an on-topic question.

\$\endgroup\$
  • 1
    \$\begingroup\$ That is post-edit (admittedly, maybe it should have been edited as a first response instead of VTC), but it is the general question I'm interested in. \$\endgroup\$ – Kaz Sep 3 '15 at 16:56

You must log in to answer this question.

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