How to get more - and better - answers to your Stack Overflow questions

Research has revealed the keys to writing a good question on the popular programmer Q&A site

Screen shot of Stack Overflow websiteImage credit: ITworld/Phil Johnson

Are you a programmer who asks questions on Stack Overflow, but aren't always satisfied with the answers you get? Do your questions get ignored? Do they fail to attract answers from users with high Stack Overflow reputations - or from very many users at all? Well, maybe the problem isn't your questions but, rather, the way you're asking your questions.

Based on recent research, it turns out that there are ways to ask questions on Stack Overflow to increase your chances of getting more - and better - answers. Takipi, a software analytics company, recently analyzed over 10,000 Stack Overflow questions asked since 2011 about six major programming languages: Java, Ruby, Python, C++, JavaScript and C#. Their goal was to try to identify what makes up a “good” Stack Overflow question. They defined a “good” question as one that generated lots of views and upvotes and which got high quality responses (i.e., upvoted answers from people with good SO reputations) in a timely fashion.

According to Takipi's findings, if you want to write a good Stack Overflow question, do the following:

Keep it short

Shorter questions, they found, got the most views and upvotes. The average length of a good question was 1,200 characters (3-4 paragraphs), compared to an overall average question length of 1,800 characters, with really short questions (200-300 characters) doing the best.

Put the language or topic in the title

This may seem obvious, but one of the best ways to get answers is to make sure your question title contains the language or topic you're asking about. For example, Takipi found that 58% of Java questions with the highest number of views included “Java” in the title. So, don't be cryptic.

Indicate you're having trouble or that something isn't working

Questions that indicated failure, because something isn't working properly or because you can't figure it out, got the fastest and highest number of responses. Although, interestingly, these questions did not attract answers from the high reputation people.

Ask about comparing different technologies

The researchers consistently found that questions asking for comparisons of technology A vs. technology B were a "good recipe for high quality answers." Obviously, your question may not be about a comparison at all, but if you can frame it that way, you're likely to get faster and better answers.

Takipi also found that people with high SO reputations who ask questions are much more likely to get answers from others with high reputations. That's not something you can easily control, obviously, but it's another reason to work on building up your Stack Overflow reputation in the first place.

The researchers also found that the following things did not have a significant effect on the answers a question got: whether the title was written as a question, what time of day it was asked or whether the question included code snippets.

I recommend anybody interested in this sort of thing go and read their original post on their findings for more details and insights, including their specific methodologies. It's an interesting read. 

Got it? Great! Now, go forth and ask lots of good questions on Stack Overflow!

Read more of Phil Johnson's #Tech blog and follow the latest IT news at ITworld. Follow Phil on Twitter at @itwphiljohnson. For the latest IT news, analysis and how-tos, follow ITworld on Twitter and Facebook.

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon