8
\$\begingroup\$

What if someone posted a code to review and he/she doesn't have the basic knowledge or logical approach of the programming language they are using and their code doesn't make any sense; should i

1) clean their code for them and post a new working code ?

or

2) recommend them to study the basics ?

\$\endgroup\$
  • 2
    \$\begingroup\$ Is this a general question or are you asking because of a specific post? If it's the latter, could you link to the post? \$\endgroup\$ – svick Jul 7 '13 at 1:10
  • \$\begingroup\$ @svick this is the post. \$\endgroup\$ – Anirban Nag 'tintinmj' Jul 7 '13 at 7:49
22
\$\begingroup\$

You should find the most pressing issues and comment on them. Do not clean their code for them, but show examples to illustrate your points.

Code is never "too bad" to review. As long as the code is working, has a minimum standard of formatting and otherwise is on topic, it can receive a valuable review. Remember that a review does not need to improve all aspects of the code. While perfection is indeed the goal, Rome wasn't built in one day.

You should give helpful, generic tips on how to improve the code on the most pressing matters. Demonstrate what you mean by showing concrete examples from the code that has been posted. Post rules of thumb and guidelines where possible and appropriate, because users with horrible code are likely to be at or near the novice level of the Dreyfus model. Finally, encourage the poster to make a new post with the improved code, so that you can comment on and review the rest. Iterate this process as necessary.

Feel free to recommend more studying and reading. Stating "You should read more about [topic]" is sometimes the best advice. In these cases, try to be as specific as you can about which topic they should read up on. Recommending good reading material is often helpful.

There are many reasons why you should do this:

  1. The poster is not overwhelmed and demotivated by all the problems with the code.
  2. You will implicitly convey what the most important issues are.
  3. By giving piecemeal reviews, the chances of the poster remembering what you have pointed out are greater.
  4. You don't have to torment yourself with detail-reading horrible code.
  5. Answers that are not massive walls of text are, in my opinion, more useful to other readers.
\$\endgroup\$
  • 3
    \$\begingroup\$ Great explanation. I really need to keep these things in mind as I answer more questions. I go overboard sometimes, mostly because I want to "learn" from my own answer as well. \$\endgroup\$ – Jamal Jul 9 '13 at 14:54

You must log in to answer this question.

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