13
\$\begingroup\$

This answer:

File Async writer using Tasks or new features of .Net 4.5?

The code in the answer doesn't log until program termination -> lost items in the log. You cannot execute parallel code against it as a result (try 100 tasks at once).

It runs into some kind of non-obvious buffer.

The result: I wasted 2 hours looking at some broken code that was highly upvoted when I could have sat down and written something from scratch.

So what can you do in this situation? It clearly wasn't code reviewed.

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

Who reviews the reviewers?

Voters do.

You have some options for this:

  • Add a comment (if you have the reputation)
  • Downvote (if you have the reputation), and if you downvote it is recommended that you also add a comment.

You did the right choice by adding a comment.

Given the number of questions and answers on this site, I don't expect everyone to actually test all the code in the questions and answers. At least for me, usually I just read the code and the text in the answer and vote from that. Probably users read the text and think "Yes, this sounds correct".

Now, I don't want to "defend" the answerer here but it is possible that the code was partially tested, but not as much as desired in this case.

Summary:

Add a comment. Downvote. Also, you can visit our chatroom and express your opinion about the answer. There are many questions that receives much more attention just when someone posts it in the chat. That's all you can do.

\$\endgroup\$
9
\$\begingroup\$

In addition to @Simon's suggestions (commenting and downvoting), you have two more options:

  • Edit the answer to fix a bug (if you are certain that a small change will take care of the problem)
  • Post a rebuttal as a competing answer. In that case, it would probably pay off to advertise your new answer in chat, since the original broken answer already has so many upvotes.
\$\endgroup\$
8
\$\begingroup\$

Answers on Code Review are meant to be “these are issues I found in your code and this is how I would fix them”, not “this is how I would solve this task”.

What this means is that you can't look at an answer by itself, you have to consider it together with the question. And if there is some issue in the code in the question that an answer missed, it doesn't make the answer wrong.

This also means that code from an answer may not be ready to be copy-pasted in your own codebase, but CR was never meant to be anything like that.

\$\endgroup\$

You must log in to answer this question.

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