I posted a question, and after it had been up a couple hours, I realized how some of the code could be improved, so I posted an answer myself. After I did so, though, I wasn't sure if I had done the right thing because no other answers had been posted and I could have edited my code to just show the updates. Which action should I take in the future?
Either action could be acceptable. Keep in mind that there is a possibility of a race condition (another user writing a review while you are enhancing the question). Therefore, I suggest…
- Changes that are more trivial can be sneakily edited into the question before any answers have been posted. (Make your edits seamless, as if the question had been originally asked that way, rather than as an addendum.)
- Changes that are more strategic in nature would be better as self answers.
Leave your question the way it is. You have a solution for it, so add that. If someone else is looking for a solution to a similar problem, they won't be able to get anything out of your question if the original code is gone.