I am a frequent Stack Exchange user and often ask questions, especially on Stack Overflow. Today it happened to me that I asked three questions and answered them myself shortly after thinking about the problem a while longer.

I am not sure if this is okay or if I am violating a best practice here. It happens to me from time to time that I answer my own question, but never before that frequently.

Is there anything I can/should do to prevent this in the future or is it perfectly normal and accepted to answer one's own questions?

It's absolutely fine (assuming they're high quality and probably of use to others)
–
Richard TingleApr 8 '14 at 13:35

2

Oded beat me to it but I would add that if it seems to be happening quite a bit then maybe you want to spend a little more time thinking about your questions. Not so much for the sake of the site but to work on troubleshooting more before asking for help. This may quite possibly help you in the long run as a programmer.
–
codeMagicApr 8 '14 at 13:37

3

Personally I do find writing the question out in a manner that allows someone unfamiliar to my work to understand it often highlights flaws or points I didn't previous consider. So writing the question itself may be benefiting your thought process.
–
AmicableApr 8 '14 at 13:43

@RichardTingle Well, but you get rep for marking an answer as accepted. Which you would presumably then be doing on your answer after answering, but you don't get rep from that.
–
neminemApr 9 '14 at 15:57

Other answers tell you that it is ok as long as the question and answer otherwise belong, but not how to know that. Let me give you some guidelines:

generally, someone asking when they already know the answer writes a bad question. This doesn't apply to you, since you didn't know when you asked, but I mention it while we're discussing self answering. The question should be a question and meet all the norms and rules of the site

the question should not attract close votes or downvotes, or comments telling you that it's offtopic, too broad, unclear, and so on. Sometimes the reason you don't get answers from the site is that people don't know what you're asking, so they can't help you.

your answer should be complete and useful to others (you have to pass null for the third parameter, not I figured it out, never mind)

If your question or answer got an upvote, the community is letting you know you're doing fine, and that's more important than whether this happened three times in one day (or ten!)

What if your question or answer got a downvote? What if, once you figured out what's going on, you feel you should delete your question? In general, don't. Users with a very small number of questions who delete some, especially ones with negative score, risk a post ban. Try editing your question to be more useful. For example, instead of "where is the typo in this code?" you could ask "what does this error message mean and what causes it?" and then answer that.

Finally, don't feel that you have to actually post every question that you ask. As others have reported, just writing it up in a suitable form for SO often leads to solving the problem. You can cancel at that point and no-one will ever know. Also, while you type the question you are offered related questions that might contain your solution. Never hesitate to start asking a question even though you may never actually post it.

It is normal and accepted to answer one's own questions. Other answers have pointed out that quality still matter, but I think more can be said about the topic of quality.

As far as I see it the best question for a self-answer is a question that requires some substantial research or substantial experience with the technology which is the subject of the question. Since these questions require substance it is unlikely that one would be able to knock them out in quick succession.

At the opposite end of the spectrum, the self-answers that I see most often are those that amount to typos, or that are due not reading the manual. It is extremely easy to post these in quick succession. They are not very valuable.

In a few extreme cases, I've seen some users submit a bunch of "read the manual" type of problems, with self-answers. Reading these Q&A felt like reading a manual for the technology. They did not elucidate an obscure point, or solve a problem that required bringing together multiple parts of the documentation. In effect, it felt like these folks had decided that they would seed SO with questions and answers that were trivially answerable from looking at the documentation and reap the reputation. I flagged them and their posts disappeared.

Consequently, in my view, the more frequently one posts answers to their own questions, the less likely that these questions are high quality questions. Is it a hard and fast rule? No. Someone could work on a bunch of really hard problems, format these in a Q&A format and post them to an SE site in close succession. But it is something to keep in mind if one finds oneself answering one's own question frequently.