6
\$\begingroup\$

Suppose a newbie asks a question on SO with an MWE that's adequately formatted, but there are mistakes in style and organization that make it difficult to understand the code. OP is trying to ask a question, but doesn't know enough to formulate an MWE that allows asking a good question. Maybe the source of his/her problem is just that the code doesn't work as intended because it's confusing, but who knows? What OP needs is advice about how to organize his/her code, and this is needed before a proper question on SO can be asked.

Would it be appropriate to move the question to CR, or to suggest to OP that s/he ask for a code review on CR? Questions that I've seen on CR are at a more advanced level. Is CR appropriate for those in early stages of programming?

(For example, this question is about a procedure that is called by a procedure that is in an iteration (ask) over a collection of items ("turtles"), and then does something to each turtle specified in the iteration--which is two procedures up--after also iterating over all of the turtles (called bigs and smalls) in the inner procedure. I don't think there's any reason to organize the code in this confusing manner. There is not yet an MWE, but this is the SO question that motivated me to wonder about whether it's appropriate to send a newbie to CR.)

\$\endgroup\$
  • 1
    \$\begingroup\$ Mostly working example? Minimal working example? \$\endgroup\$ – 200_success Jan 9 '15 at 1:01
  • 1
    \$\begingroup\$ I remember the good old days when if you used an acronym you included it in parentheses after the first usage (FU) \$\endgroup\$ – Nick Udell Jan 10 '15 at 13:12
  • 2
    \$\begingroup\$ Sorry--on StackOverflow (SO), "MWE" (Minimal Working Example) is often taken for granted. I just assumed it would be that way on CR. (I'll leave "CR" as exercise for readers :-) no snark intended). \$\endgroup\$ – Mars Jan 10 '15 at 18:52
17
\$\begingroup\$

Programs and Programmers go through stages. For Programs, it's from idea, to design, to development, to testing and finally to release.

For programmers, there are novices, 'junior', 'senior', etc.

Code Review does not have a rule about what stage the programmer is in, but it does have a rule about what stage the program is in.

If your program is in the early stages, and you are struggling, there's a good chance you could get assistance on Programmers.se - that's when you are dealing with concepts, designs, strategies, etc.

If your program is in the development stage, and you are struggling, there's a good chance you can get help on Stack Overflow, where specific programming problems are solved.

Code Review fits in between the testing and the release phase - for those times when you think your code is ready for release, and you believe it works, but you want someone else to give it a once-over, and look for unexpected edge cases, alternative considerations, etc. When the work is essentially done, but you are just looking for a 2nd opinion.

For code to be on topic on Code Review, it is expected that it passes all the tests that it's expected to pass. At a minimum:

  • it compiles
  • it runs without error on the anticipated use cases
  • it produces the correct results in the right format and presentation

Code review is not for helping you to solve problems that need to be solved to pass the testing phase.

A side-effect of Code Review, is that for the programmer, it is often a way to take you 1 step further, to teach you one more thing, to get a bit more experience.

In the specific question you link to on Stack Overflow, you've done a good job there with your answer, and I believe you are right that the question code needed some structure and order. But, even neat and tidy code, if it does not accomplish the task as intended, then it's not on-topic for Code Review.

On the other hand, once the code works, then send the code on over, and we can review it. Note, there is a tag designed to indicate those times when the programmer is new, and it is an indication that the reviews should be more forgiving, and suggest simpler, or less advanced strategies, etc.

\$\endgroup\$
11
\$\begingroup\$

Is CR appropriate for those in early stages of programming?

Absolutely! However, the code must still work as intended. If the OP is unsure, then the question may have to stay on SO. This may look more like a grey area, but regardless of skill level, the OP is still responsible for making sure that all output checks out. If there are hidden bugs not revealed by any testing, then even if they're discovered on CR, they can still be addressed. We don't close questions in cases such as these.

This is not about the difficulty of understanding the code, though. Even if someone on SO has a hard time reading the code, it doesn't automatically make it a good question for CR. Otherwise, users may see that the code is clearly broken and will promptly vote to close. A question doesn't belong on both sites at the same time, either. If it doesn't work, keep it on SO until it works. Once it does work, have the OP post the working product on CR.

\$\endgroup\$
4
\$\begingroup\$

No, well maybe

The reason is that we deal with working code only.

If the code doesn't work it doesn't belong on Code Review.


If the code functions according to its purpose, then yes, otherwise no.

\$\endgroup\$
  • 1
    \$\begingroup\$ Wafflesty waffle I ever saw waffle. \$\endgroup\$ – RubberDuck Jan 9 '15 at 1:29

You must log in to answer this question.

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