One question that comes up a lot in Stack Overflow meta-discussion is this one:
Why can’t I accept my own answer to my question?
In case it isn’t clear, asking a question on Stack Overflow confers a few special privileges to you as the question owner:
You can comment on your questions, even if you don’t yet have the required 50 reputation to do so.
Any answers you provide are highlighted in a special light blue color.
- You can mark (or unmark) one of the answers as the accepted answer, which results in a +15 rep boost to the answerer, and +2 rep boost to you. This also “docks” the accepted answer permanently under the question.
When viewing your question, you’ll see something nobody else does in the answers: a large checkbox under the voting arrows. This is the accept icon, visible only to question owners.
Mousing over the accept icon shows a tooltip that explains what it does. Clicking the accept icon will mark that answer as the accepted answer. (It can be clicked again to toggle it off.)
As you can see, the background of the answer turns green to indicate it’s the accepted answer. This will also show up in the profiles of both users, and there are several badges tied to giving or receiving accepted answers. Once the question owner accepts an answer, it is permanently docked under the question, regardless of sort order.
It’s generally considered good etiquette to accept an answer to your question, unless your question is fundamentally unanswerable (which means it probably wasn’t the right kind of question to ask on Stack Overflow in the first place, though there are certainly valid exceptions.)
I’ve answered variations of this question at least a dozen times on UserVoice, and it always starts with the same response:
Accepting answers is completely optional.
The question owner is not required to accept an answer to their question. We view accepting an answer as a simple social convention, a little informal “thank you” between the asker and answerer, a virtual tip o’ the hat to that person whose response, as the question owner, you personally found the most helpful.
That doesn’t mean the community will agree with your choice. But as the question owner, it is your choice to make.
The default sort order is “votes” for a reason. Normally, the best answer will automatically float to the top through community voting. This is important because we expect a lot of our question askers to be drive-bys, programmers who ask a single question, get the answer they need (or don’t), and are never seen again. This is intentional and by design. We’re not building some hyper-viral social networking tool like Facebook or MySpace or LinkedIn where we try to game you into hanging around and socializing and building lists of fake friends to get results. You’ve got work to do, and Stack Overflow is only useful insofar as it lets you get your answer quickly and get on with your job.
So in the typical case, you’ll have this:
|Community Selected Best Answer (votes)|
But you might also have this:
|Owner Selected Best Answer (accepted)|
|Community Selected Best Answer (votes)|
In the latter case, you have the best of both worlds. The answer the owner thought was best, and the answer the community thought was best. Right next to each other, both directly under the question. No reading through a giant thread required. Immediate satisfaction with a minimum of scrolling.
I’m not saying this always works, of course, but we’ve been pleasantly surprised how often it does — and a lot of the emails and feedback I get seem to agree. Generally, the “system” works, which hopefully isn’t surprising because the system is you.
Now, this was a very long winded way of getting to the original question. The question owner cannot select their own answer as the accepted answer. This is very much by design.
Although it’s fine to ask and answer your own question — this is specifically encouraged in the faq — you’ll have to rely on the community to upvote your answer and validate it as correct. You, sir (or madam), are biased. Of course your answer to your own question will be the best possible answer. You wrote the darn thing!
Allowing question owners to accept their own answers would be a violation of the spirit of Stack Overflow, akin to giving yourself a self-congratulatory pat on your own back. We’re here to acknowledge the skill of the collective community, and our own humility in not knowing the answer to everything. It’d be downright rude to deny your peers the opportunity to weigh in on your question, for good or bad.
Asking a question is an opportunity to connect with and learn from your peers. That’s what accepted answer is for. It’s completely optional, because if it wasn’t, the system would be in a perpetual state of broken. But in my experience, it’s one of those little details that separates good programmers from great programmers: great programmers enjoy and even seek out ways to acknowledge the skills and experience of their peers.
I encourage you to leave your own answer on your own question, of course. But I’d also encourage you to go out of your way to find the greatness in another programmer’s answer to your question — even if you think you’ve already found the right one.