Wednesday, December 7, 2011

How Do GOOD Programmer or IT Ask Questions?

I spend a lot of time on stackoverflow.com and I've seen my fair share of questions. Some good, others leave you wondering how the hell some people made it this far. Good Programmer have learned how to ask questions to get the best possible answer in the shortest amount of time.

First of all, let me say this. If you consider yourself a developer and don't find yourself wanting to ask questions on a daily basis, you're doing something wrong. Asking questions without being afraid of humiliating yourself is critical.

Let me throw out a few pointers that I've gathered from reading hundreds (if not thousands) of different questions on sites like stackoverflow, experts-exchange, and other various forum-type sites.

  1. Don't be afraid to over-describe your problem. Some people seem to be afraid to muck up a question with speculation, code-snippets, or extraneous details. When, in fact, many times these elements can be vital to help figuring out one's dilemma. Of course there is a limit, don't post your entire class library, unless requested, and expect unpaid volunteers to sift through everything.
  2. Include error messages. If I see another question that has some variation of the phrase "It doesn't work" or "It failed" I'll flip my lid. People need to know precisely how you know something failed. What you think might be the obvious outcome of a particular situation may not be clear to everyone else. So make sure to clearly define in your question What you expected to happen, and exactly what happened instead no matter how trivial it might seem.
  3. Briefly list out your environment particulars. Aside: This is starting to sound a little bit like my other write-up 'Things I Hate - People Who Do-Not Know How to Report Bugs'. Environment variables are far too often overlooked. Take a few seconds and list out a few pertinent details like software used, version numbers, etc.
  4. Speculate! I hinted at this before but narrating your own question can be extremely helpful. Sometimes, your situation may seem so bat-crazy to others that they have no clue what you're trying to accomplish. Including a few blurbs about your thought process can allow readers pinpoint where you went awry and explain why.
  5. Examples. It may not come to this but sometimes examples are the only way to accurately describe your question/situation. Start with snippets of code and expand from there. If you're working with the web it might be worth it to setup a quick and dirty demonstration page that others can view. For things like CSS questions this is sometimes the only way for others to know what you mean.
  6. Phrase the question so that you not only obtain the answer, but learn how to research similar questions in the future. This one really irks me. There are countless habitual abusers of stackoverflow that ask up to 50 questions a day that could be just as easily been placed into Google and click I'm Feeling Lucky. Self-exploration and research should ALWAYS be the first step before posting a question. You will learn tons more by trying to find the answer yourself. Even if you don't find the final solution you were looking for you may discover other unknown tidbits of knowledge or some sort of work-around given by another frustrated developer. Failing that, include your research strategy in the body of your question so that, along with the answer, others can suggest where you may have gone wrong with your Google searches.
  7. Don't get offended by responses. Most of the time, people leaving answers or additional questions are doing so in their spare time (or at work slacking off). If you post a question and someone leaves a response asking if you checked a variable to make sure it contained what you think it should contain don't go off on them. You might be inclined to respond with something like 'Of course I checked. Do you think I'm stupid? That's the first place I checked! You're lame for even asking that!' This may seem over the top but, believe it or not, I've seen worse. Like I said, assume NOTHING when asking questions or posting follow-ups. Unless the user is obviously being malicious or trolling you should always kill them with kindness.

Just a few simple things to keep in mind. Be humble, specific, and realize that everyone has been in your situation at some point. No one has all the answers, and if they did they certainly got some help from those around them.