I've asked a question about regular expressions. I've got one correct answer and a answer that shows a way better solution for my problem. Actually the answer with the better solution isn't a correct answer IMHO since it's not answering my question.

Select the one that's the most useful for you.
–
Qantas 94 HeavyApr 23 '14 at 15:20

3

How could a solution be way better and also not be correct? Wouldn't being incorrect make it not be better?
–
ServyApr 23 '14 at 15:21

1

Upvote the one you found most helpful to you, in the specific problem you had. You could leave a comment that the other one was a very good approach but didn't answer your specific question.
–
La-comadrejaApr 23 '14 at 19:56

@La-comadreja Then it's not a better answer, if it's answering the wrong question. It's a worse answer, for failing to answer the question at all.
–
ServyApr 23 '14 at 19:59

it seems Lucas has been a bit unclear with the wording of the 2nd sentence but the 3rd sentence seems to explain. Other answers could be prettier responses that are relevant to Users in general, but not so much to the poster of the question.
–
La-comadrejaApr 23 '14 at 20:00

4 Answers
4

There is a difference between answering the posted question and solving the problem presented in the question.

SO tends to be more of a database of question-solution. As such, I'll say that you should accept the answer which directly answers your question and upvote the one which provides a better alternative solution.

You have to consider that others with the same problem you had will find your question and might not be able to incorporate the alternative solutions for whatever reason (could be even that it's homework and they are just restricted to certain usages). They want an answer to the posted question, and as a bonus they can see better ways to solve the problem.

Sorry but I disagree with They want an answer to the posted question, and as a bonus they can see better ways to solve the problem.. In my experience people mostly want to solve their problem and are answers to their questions more of a bonus.
–
Dennis JaheruddinJul 11 '14 at 14:48

Accept the answer that best solved your problem - after all you are asking about a real problem you have, right?

Personally I would accept the one that provided the better solution. A regex type question could get a dozen 'correct' one line answers but an answer that actually solves your problem and furthers you in the process is the one that I would give the 'prize' to.

In general I would say that the best answer would be one that solves your problem but is also general or complete enough to be useful to other users with similar (as opposed to identical) questions. Solutions that work for a variety of situations (within reason!) are, in my opinion, superior to those that work for only a very limited, specific situation.

For example, I once asked a question about parsing simple, consistently structured HTML using Perl. One user gave a very complex regular expression that worked well in my situation, but another user encouraged me to pursue using a Perl module built specifically for parsing HTML. I ended up implementing that and learning a lot in the process. That solution helped me but I'm sure it also helped other Stack Overflow users or passers by, and I think that gets even more to the heart of Stack Overflow than just what works for you.

If somebody provided a better solution then what you asked for, you are like most users on any helpdesk: You dont ask for help with your problem, but you ask how to implement what you think is the solution.

I see it all the time on SO and any other forum/helpdesk I have visited and unfortunately it mainly involves the none lazy people. They did try to find a solution for their problem themself as requested/advised by SO, but they are only searching for solutions within the scope of their knowledge. And then after a few hours of messing around in copy/pasted code they ask help to implement their solution, without mentioning the actual problem.