About 5 years ago, as I started out on Stack Overflow, I was simply looking for a way to keep track of answers that I see. Then, one day it felt like I could use some validation. If I could get out there and answer few questions from others, I could somehow prove a better developer than them.
Today, after over 350 answers and a reputation of 10,000 there is more of a sense of calm in my approach to answers. Here are a bunch of things that I learned along the way:
Explain the answer I’m sure we can all use consistent naming and functions to decorate our codebases. But the case is not the same for someone looking at your answer. If you are only providing a code snippet, them and everyone else looking at it are bound to be confused. Explain what you are doing differently from the OP and why.
Link back to the docs This ties in with the sound of that’s obvious in our heads. Very often, these things are not obvious at all. The documentation would provide upto date examples and explanation of all the options that the user can take in case of changing things up, instead of trying to over explain everything from the docs, quote the important part and link back to the page.
Runnable Snippets Whenever the question or the answer had a runnable snippet, a resolution was reached much faster than the one without it. Nobody likes to read code and it is some sort off validation to see the code actually working. As a web developer, I often relied on platforms like codepen, codesandbox and stackblitz for my live demos. While this approach surely works and is mostly easier, it starts to wear down on you with time. There are hundreds of snippets that are halfway done, some linked to answer, some not that I have lost track. In case you delete some of these for space, some of your older answers would be broken and cannot help others. Stackoverflow has an in build snippets tool for web developers and while it is sometimes a pain to create, it’s much easier to maintain.
Not all worthy questions Sometimes the questions are either duplicates or caused by simple typos. While you can go ahead and answer them, may be rack up a few reputation points, it is often unfair both to the person who asked the question and StackOverflow as a platform. There are flagging and closing options for questions, use them wisely. StackOverflow guide to How to write a good answer is a good starting point.
Admit that you may be wrong Your large reputation or years of experience does not make you all-knowing. There are chances that others might come upto you and make suggestions or sometimes tell you that you are wrong. Being patronising/condescending towards them does not serve your purpose. Evaluate their comment, if you are wrong admit it, learn from it and move on.
Today, it is no longer that sense of validation that I seek from StackOverflow. Answering a question does not make me a better developer than they are. It is often the bravest thing to do to face a crowd and admit that you don’t know the answer and the internet only makes it harder. Cheers to everyone who keeps learning 🥂