What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

Let us assume that someone posted a question about allocating a 2D array in C++, his code doesn't compile because he has errors in it.
Now after you read the question, you see that he should use std::vector becuase it's better and more recommended in his case. But he's asking about arrays and not vectors.

Now let's say someone posts an answer that solves his problem (with an explanation), but std::vector is not mentioned in the answer (as OP wasn't asking about vectors).

Should this answer be downvoted because it doesn't suggest a better solution? Or it's fine because it solves OP answer?

share|improve this question

marked as duplicate by ben is uǝq backwards, Martijn Pieters, Azik, Mołot, hims056 Oct 28 '13 at 9:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
Why would you downvote a good answer for a bad question?! Shouldn't you downvote the bad question instead? –  R.J Oct 28 '13 at 7:52
1  
    
@R.J I don't mean that the question itself is bad, what I mean is that the OP is still a beginner and doesn't code a "beautiful" and efficient code. I think that we should correct his mistakes, and not suggesting something "better" (that might be more complicated) and won't help him to better understand his current mistake. –  Maroun Maroun Oct 28 '13 at 7:54
3  
@MarounMaroun - In that case, you SHOULD go ahead and post an answer suggesting why using vector's would be helpful. Downvoting an answer which actually fixes the OP's original problem doesn't seem right(though votes are absolutely your right and nobody can advice you on how and where to use it). –  R.J Oct 28 '13 at 7:57
    
@R.J Yes, but it doesn't answer the OP question since he'll not learn from his mistakes. I remember that in my university, we had an exercise to implement String class in Java (Now if I posted a question about that, someone would say "don't reinvent the wheel").. Sometimes someone learns the basics and doesn't have to know about vectors or whatever in this stage.. –  Maroun Maroun Oct 28 '13 at 8:02
    
Sorry, but I wasn't exactly able to grasp it. Are you saying that the answer you might post(with the suggestion of using vector) won't answer the OP's question? –  R.J Oct 28 '13 at 8:06
    
@R.J Yes, because he's actually asking about arrays, so he has no idea what vector is.. :) –  Maroun Maroun Oct 28 '13 at 8:07
    
@MarounMaroun - In that case, its upto you, whether you want to leave a answer/comment for the OP to consider using a Vector which might help him, or else, just move on. If you really feel that this might help the OP very much, I strongly urge you to go ahead and post it as answer. It might not help this OP now, but it might be very useful for some other user in the future. –  R.J Oct 28 '13 at 8:12

4 Answers 4

up vote 12 down vote accepted

You are entirely free to choose how to vote.

That said, why should genuine answers that you find helpful be punished for the quality of the question? I vote on the merits of individual posts, myself.

Moreover, I try in my answers to help the question asker as best as I can. If that means pointing out that the OP is barking up the wrong tree and that a different technique is better, then I certainly will do so.

For example, when a question asker asked about removing newlines from quoted CSV values, I didn't give him the requested regex to do so but instead pointed to the CSV parser that handles newlines in quoted values correctly.

If the answer fixes the underlying problem, then why would that answer be wrong or unhelpful?

share|improve this answer
    
I agree. If you see a XY Problem, point it out. –  Johannes Kuhn Oct 28 '13 at 8:36

In such a case, you should actually go ahead and post an answer to that question suggesting why using vector's would be helpful. That's the purpose of SO, isn't it. Even if the OP doesn't use vectors, there might be a user in future who would come looking for an answer for a related question and might find your answer very helpful.

Having said that, I also feel downvoting an answer which actually answers the OP's original problem doesn't seem right (though votes are absolutely your right and nobody can advice you on how and where to use it).

share|improve this answer

I don't think you should down vote the answer. You could post your own with an alternative solution and explanation why something else is better to do in the case.

But...

Consider the scenario when someone requirement is to use a 2D array instead of vectors - could be homework, work-related, learning from book where the OP has not reached the vectors sections or something similar.

If the question is specifically about the 2D array just make sure you are not radically changing the meaning of the question giving an answer.


Your statement

but it doesn't answer the OP question since he'll not learn from his mistakes

is what we call Primarily opinion based. I don't think you should put yourself in a position where you're judging whether the OP is going to learn or not from an answer provided(not by you). You have the right to downvote any question or/and any answer.

The idea of asking a specific-programmatic question is to get a specific answer to the question asked. If the OP asked for a 2D array solution then that's what he was interested in.

I suggest to take advantage of the comments section below the question. If something is unclear or if you would like to propose another solution then simply ask the OP:

have you considered using vectors to solve your problem?

share|improve this answer

If question is unclear, answer can get downvoted because voter's interpretation was different and answer did not cover it at all, or was outright wrong (for that interpretation of a question). Same with questions that are too broad. And for off-topic (in English language meaning of that term) questions, answers are usually off-topic as well.

If answer works, but encourages bad practices, I would suggest to comment first, and give answerer's some time to fix it. But downvoting to push it behind good-practices answer seems like perfectly legitimate use of votes, too. Harsh, not nice, but legitimate and useful at the same time.

Thus, there are many perfectly valid reasons to downvote helpful and properly written answer to a bad question, that are not "punishing for question's quality" directly. Only punishing for answering duplicates seems outright and clearly wrong to me - if someone knows it's a duplicate, it's his (and others like him) fault it isn't closed yet, not the guy's who answered it.

share|improve this answer

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