Growing with the Web

Asking better questions on Stack Overflow


Stack Overflow is a brilliant resource for asking software development questions. There is a certain amount of etiquette you should follow though that isn’t immediately obvious to new users. This article tries to clear this up so you can get down to asking great questions and helping the site, the industry and the web grow.

Stack Overflow logo

Break your question down and Google it first

The amount of questions I’ve answered that I didn’t know anything about before reading them would probably surprise you. Unless your question is either very specific or is on a new technology, then it has probably been asked and answered before somewhere on the internet (likely Stack Overflow). One part where I think people fail in this is correctly breaking down their problem into multiple sub-problems.

Don’t add the technology to the title just because

This is what tags are for, so don’t include the language or technology in the title unless the question makes no sense or doesn’t read well without it.

Consider for example the question:

Looping tables in ASP.NET MVC C# HTML

Not only is this question badly worded, it contains information that isn’t super important, namely C# and HTML. This would be a much better title:

Iterating over table rows with Razor

As you can see it’s far more clear what you want to accomplish and instead of ASP.NET MVC, the templating engine is included since it’s more specific.

Omit greetings and thank yous

Stack Overflow got so popular because of it’s keen focus on the question and cutting down discussion as much as possible. Many users consider greetings and thank yous to be unessential noise on a question, you will often have these edited out by other users.

If you want to thank someone, give them an upvote.

Include a SSCCE

Many people who ask their first question on Stack Overflow, don’t include any code and expect people to know the fix magically. You should always include example code for the question you’re asking, ideally as the term goes short, self contained and correct.

For web development make sure you include an example on jsFiddle unless you’re unable to do so. This is very likely the method that people will use to answer the question and you’re just making it easier for them.

If you don’t include an example you can expect to have your question closed. Always keep in mind that you’re asking strangers that are professionals in their field for help, you should make it as easy as possible for them!

An important thing to keep in your mind when asking a question is that the answer isn’t just for you, it’s for everyone. Because of this, questions should be self-contained including the relevant code samples and a link to jsFiddle if necessary to demonstrate the problem as highlighted above.

Tag correctly

Seasoned answerers of Stack Overflow have a set of ‘favorite tags’ which define the majority of questions that show up in their feed on the homepage. This is the primary way that experts discover questions to answer. Meaning if you don’t use the correct tags, you probably won’t get the best answers.

Formatting matters

Putting a little care into the formatting of the question, particularly code formatting and indentation will make reading it a significantly better experience for the people answering your question. Which can lead to more attention and answers.

Make sure you give it a go

Remember that Stack Overflow is not a service to outsource your work or homework. Make sure you actually try and mention what you tried in the question as it will help to clarify what you want.

Google it again

Really, when you have finished writing up the question try Googling it again now that you’ve hashed out all the details.

Make sure you accept your answer

If someone answers your question and you’re satisfied with it, you should accept their answer. Now only will this give ‘reputation’ to them but also to you, helping you unlock additional privileges. It’s the best way to show your gratitude to the answerer.

Don’t add [SOLVED] to the question

On the home screen, questions with accepted answers are indicated by a yellow answer count and on the question page the top answer will have a tick. Adding [SOLVED] to the question once it is answered just adds noise.


comments powered by Disqus
Like this article?
Subscribe for more!