Hot answers tagged

40

I'd like to describe what I would like to see on this site, rather than the current practice. As noted in Answering Guidelines (answer length), there is a desire for cultural change on this site. Allowing shorter answers should improve the answer rate by lowering the barrier to contribution, and hopefully increase reputation scores all around. I think ...


35

The answer that you are referring to has been voted up quite a bit. I'd like to point out that we cannot really predict or influence how the votes go. People tend to upvote stuff that they find funny. People tend to upvote stuff that is short and easy to understand. Answers that take five minutes to read and ten minutes to understand usually don't get ...


34

Empathy... I am not necessarily a good example of a good reviewer, I have been the 'victim' of many reviews, and I have given a lot too. I am often tactless, and pedantic. I blame that on the fact that I am South African born.... but I have since moved to Canada, and culture here is much more sensitive to peoples' feelings. I'm sorry. I have had to train ...


32

The site's name is Code Review for a reason. We review the code in question by pointing out mistakes, bugs, edge cases with an explanation. Just dumping some alternative implementation without any explanation why the code is better is not reviewing the posted code. We expect the answerer to explain why something is done in the way it is done. Otherwise ...


30

IMO the answering scheme on SO is where the problem is. People answer quickies and get their upvotes, and walk away thinking they've made the Internet a better place. Allow me to make a slight generalization here. What I'm seeing on SO, from monitoring a specific tag on the daily, is a TON of similar questions involving the same handful of bugs, over and ...


29

I think it's unfair to Code Review to view reputation/vote as the metric for success of an answer or the real impact of your answer. The vote/reputation is a metric for Stack Exchange, but I feel here we're creating a bigger value. We're teaching people in a lot of ways, helping them and us at the same time. I know you probably know all of that, but my point ...


27

Be impersonal The goal of code review is to improve the quality of the code (and to produce shared knowledge that will contribute to the quality of code written in the future), not to evaluate the worth of the programmer. A reviewer can make it less likely that someone will take the review personally by directing criticism at the code, not at the person. ...


27

I believe it is a valid code review .... sometimes perhaps even the best code review is: Why are you doing all this hard work, just use that ... In specific cases where the user is intentionally doing the work, they should tag their question with reinventing-the-wheel. On code review, I would typically ask in a comment something like: "Did you know there's ...


25

A good answer is whatever the OP can learn the most from. Depending on the skill level of the OP, either a line-by-line critique or a high-level review could be more appropriate. Line-by-line critiques A line-by-line critique is often needed for beginners whose code is too confused or buggy. A pitfall, though, is that often beginners produce code where ...


25

There are all kinds of problems that can be pointed out in a code review. Good answers point out Genuine bugs Security holes Misconceptions Inefficiencies in the algorithm Inefficiencies in expression Poor use of data structures Violations of accepted programming practices Advice to understand the challenge to be solved Ways to enhance the clarity of the ...


25

In conclusion, after reading the other answers, I think that the consensus about flagging as "not an answer" is, more or less: Flag link-only answers; for example: There's an interesting implementation at http://example.com Do not flag short answers, even if they contains a link, provided that the answer would still be informative without the link; for ...


25

I agree that insightful reviews deserve more points than answers that are merely linting. However, I believe that no answer should be downvoted unless it contains advice that is actually harmful. Code Review's policy is to allow critique on any and all aspects of the code. As per in Let's work together to offer ultimately better content, faster and Short ...


24

There's a few things you might want to follow when reviewing code: Understand the asker's level of expertise: Some answers here on codereview are really in-depth. They address issues, that only experts could find, sometimes in ways, that only experts understand. While these answers are awesome, they won't help a complete newbie understand anything. Keep in ...


23

After editing many posts over time, I've come up with my own checklist for formatting posts: (I'll edit this as more things come to mind) Code Any code must be indented (manually, CTRL+K, or the {} button in the editor), not formatted with <code>/<pre>. These tags often leave extra whitespace, and if used incorrectly, hides syntax-...


23

Absolutely not! Only questions are required to have embedded code. If you can still provide good information even without any code snippets, then there are no problems with your review. As a matter of fact, one of my top answers mostly consists of paragraphs and no code snippets. Ultimately, you may decide what kind of review the question may need.


22

No, for a few reasons... Would a big-vote button help? Perhaps, but it will just introduce a different set of arguments, like: "Hey, why did you only +1 my answer instead of +2 it?" and, "Why only +1's here?" (in addition to all the "Hey, why the downvotes"...) The change would be impractical for many technical reasons There already is a 'super upvote' ...


21

This ought to be an interesting discussion. Let me pitch in a few things. Here is what I picked up from your answer, at a glance. It is honest, which is good. It points out a bug, which is also good. It doesn't really offer else much in the scope of improving the code, aside from pointing out that it is unclear what the code does. I've read quite a bit ...


21

For the record, the linked question asks: Is there any better way to do this? I believe that is the question we all want the answer to when posting code here, more or less. Is a question that asks for a complete rewrite of a piece of code is acceptable in Code Review.SE? It depends on how it is asked. If you ask "Can someone please rewrite this code ...


21

Ideal situation - asker Code Review is where you go to get feedback on your code that teaches you at least one new way to do things (better). Premise: you bring your code - and you have it in a state where it represents the best you can do. Expectation: someone helps you see things differently, that you would not otherwise have seen. Ideal situation - ...


21

That answer is .... a little special For what it's worth, pedantry is explicitly encouraged on Code Review. It helps find problems in code and makes it easier to maintain. To enjoy writing answers here, IMO a little pedantry is a necessity. yet, the community upvotes it to the #2 answer No that's not quite the case. That answer is a little overvoted ...


20

Is it acceptable to provide fully rewritten code in the answer of a CodeReview question? Yes. Actually I done this the other day. Do you have to? No. Is it encouraged? No. Is it discouraged? If it has the tag homework, otherwise no. Does the OP like it? Probably. An answer is quite personal, and so as long as you review the code, we can't slap you on the ...


20

Is it on-topic to review a challenge's requirements? To the extent that the requirements force bad code, Yes. The core of every question at Code Review is "How can I make this code better?" It is not "How can I solve this challenge?" If the asker has not gotten at least that far already, their question is off-topic here. Therefore every question at Code ...


19

Not at all! You're reviewing code, commenting on OP's practices and telling them what's good, bad, or ugly about the code being reviewed. You can do that from your smartphone if you want - and trust me when I say phone posts are painful when code blocks get involved (although not impossible).


19

How does a score card actually help the OP? Telling them their code sucks, without explaining how to improve it, is no benefit to anybody. Telling them how to improve it, by definition, involves explaining why it's not so good at the moment. So why have the score if you're just going to tell them in your review anyway. Additionally, code reviews are ...


18

My take on this is No, we should not allow such answers. Why? We're doing Code Review here, so what does that mean? Code review is systematic examination (often known as peer review) of computer source code. It is intended to find and fix mistakes overlooked in the initial development phase, improving both the overall quality of software and the ...


17

No. It's not ok to just say "Your code looks fine." A good code review gives credit where credit is due. Take this Q & A for example. For nearly two years this sucker zombified. Until someone said, You know what? I'm just going to write something. I'll just list everything that was done well.". We spend a lot of time and effort telling people what they ...


17

<moderator-hat> The first thing that comes to mind is "this user is trying to somehow abuse the system to farm upvotes, badges, and reputation score." Because yes, people do that. All the time. And when you look like you're abusing the system, chances are people will think you are abusing the system. And abusing the system leads ...


16

No, we should not encourage it Incomplete answers are fine. There is nothing wrong with them. Complete answers are also fine though (although, is there such a thing as a fully comprehensive answer?). People writing answers should feel free to comment on, and criticise and praise whatever they feel inclined to cover. If that leads to a comprehensive answer, ...


16

What should I do when someone answers my question? The page needs to mention that incorporating suggestions from answers into the question is unacceptable. It should also suggest options for follow-ups (posting a self answer or a second question). Basically, it needs to include a summary of the advice in this answer.


16

What knowledge level is required of a language before I should consider myself capable of answering it? NONE! You don't necessarily need to know a language at all in order to answer a question. Consider this answer of mine. I don't know anything about PHP, and yet that's my highest upvoted answer. There's also answers like this one. While I do know ...


Only top voted, non community-wiki answers of a minimum length are eligible