DEV Community

Cover image for How to get answers on StackOverflow
MiguelMJ
MiguelMJ

Posted on

How to get answers on StackOverflow

Talking about Questions And Answers in software development is talking about stackoverflow.com (SO from now on). There's a bad experience shared among many beginners in this site and that's a shame. Instead of taking a gatekeeping attitude, my intention here is to explain several common errors and misconceptions that lead to this bad experience in SO and how to avoid them to get the most out of that great community.

Cover foto from pexels.com

First of all: read the community guidelines

If you're an experienced user and have read/heard any rant about stack overflow you'll instantly notice that most of the problems people have could be solved if they just read the guidelines.

There is a badge in SO that you get only by reading the tour page:

Informed badge

So when I'm answering questions, this is a red flag for me:

User without badges

This user hasn't got a single badge, which means they haven't even made the effort to read the tour page. Unless the title of the question suggests that it really is interesting, the most probable thing is that the question doesn't comply the community guidelines. Most people don't want to spend their time on this kind of questions.

Go and get the badge! Read: Tour - Stack Overflow

And also one of the most linked pages in the comments of unanswered questions: How do I ask a good question? - Help Center - Stack Overflow

Actually, a part of what I say here is also written there. This is my attempt to bring this to those in DEV that might have not heard of it.

Make sure that your question belongs in SO

SO is a place for asking programming questions. You have a problem with your code? Go to SO. But code is a very particular topic. There are many others questions related to software that don't belong there, so if you post one, people will want you to remove it.

There are other Stack Exchange sites that you can use, where your question might be better received; take a look at the list of stack exchange sites to see where is the best place to ask: All Sites - Stack Exchange

Do your own research first

Nobody wants to answer the same question over and over again for each new user. Before posting your question, look up if someone has had your problem before. It will surprise you how hard it is to ask an original question.

If the answer to your question is one search away, then don't post it. It's very bad taste to make others google your problems for you.

S.O. search

If someone marks your question as duplicate

There are two possible cases:

  • Your question is actually a duplicate: then don't take it personal. The site wants to remain as clean as possible and duplicate questions are just noise. Remove the question and upvote the existing one.

  • Your question is not a duplicate of the proposed question: then kindly explain why the other question is not useful for you, what are the differences in your case and what information do you lack.

Stack Overflow is not a coding service

No one charges money for answering questions. But there you have people with full time jobs, people with years of experience and people just like you, trying to gain some experience. We are all trying to help each other and learn, so if you copy-paste the statement of your latest assignment and expect someone to post the solution for you, people will find it disrespectful.

It is not bad to ask questions about your homework, but make sure you have tried to understand what they require you to do, conduct your own research first and make a question when you have specific aspects that you need help with; those would make a valid question.

More on this topic here: How do I ask and answer homework questions? - Meta Stack Overflow

Do some debugging, reduce the scope

A lot of questions contain just a wall of code with the caption: "What's wrong?". This kind of questions usually ask you to do an effort that the person asking could perfectly do: debug.

This is a crucial step that you can take before posting that will make it easier for people to answer and help you:

  • Try to find what part of the code produces the error. Post only the code relevant to the problem. Understanding other people's code is always hard, so reduce the effort required all you can.

This is not easy to do with every technology but it is possible in most cases.

However, avoiding walls of code doesn't mean to ask without giving any details. It is much more difficult for anyone to help you without any readable and reproducible source.

More on this here: How to create a Minimal, Reproducible Example - Help Center - Stack Overflow.

Use the correct tags

Read the description of the tags before asking and try to use the ones you need. The correct tags will give your question visibility but will make sense in the context of the question. A common example: using C and C++ tags in a C++ only question.

Don't assume an offense

If they suggest or ask something in the comments of your question, don't be rude. I've seen new users answering comments with a horrible entitled attitude and I immediately lose the will to help them. Remember you are asking for help, not demanding results.


Conclusion

  • If you ignore the community guidelines, a lot of people will do the same with your question.
  • If the question belongs to another community, they will tell you to remove it.
  • The ideal question looks like this: ```

I'm trying to do A
My approach is this one:
(show relevant code, maybe cite your sources).
But I have B problem,
so I've tried C and D
but it doesn't seem to work.


Even with these steps, there will always be people that don't behave well or will not understand the requirements of your problem, but this will happen in every self-moderated online community. However, in a knowledge-driven community like SO, that will be at least less likely to happen if you try to take this advice.

***

My last tip: browse the feed of new questions for one week or two. If you only use Stack Overflow for reading answered questions and eventually asking yours, you might think that the community is very strict and closed. But when you receive day after day all those questions, you will start to see patterns and see how many users don't know how to properly ask for help, how many ask you something that is a DuckDuckGo/Google search away and that haven't even tried anything before asking. I know you can do better.

I also know a lot of people here have resentment against SO. I hope this helps in some way to bring beginners closer to this community, without which software development would be completely different from what we know, and ease the experience of everyone involved. If you have any other tips or comments in this respect, I'll be happy to read them!
Enter fullscreen mode Exit fullscreen mode

Top comments (17)

Collapse
 
codenameone profile image
Shai Almog

Well said!

A lot of developers have a problem with stack overflow deleting questions. Editing or generally closing a question which you think is valid. This is because many moderators have a bit of OCD and tend to "over clean" the site.

This is what makes the site so great for searching for answers. But asking sometimes feels like you're being attacked. So a couple of my own tips:

  • Don't tag randomly - You mentioned this but I'd like to add another aspect to that. Moderators are attached to specific tags. If you place a tag that might be confusing a moderator might misunderstand your question and close it. E.g. I handle the codenameone tag. We use a flavor of Java. Lots of times people add the java tag and moderators just close the question incorrectly

  • Don't take it personally - use the comments section to ask why a specific action was taken. Edit your question and try to fix it and comment back to the moderator so they won't miss the edit. Understand that the motivation of the moderators is to prevent SO from becoming a noisy/messy site. Work towards that

  • Use rewards and spread the word - If you answer enough and have good questions you get points. You can hand out some of those points as a reward to get better answers. I have a lot of points and hand out rewards when I ask questions (unfortunately mine are usually too tough/obscure). You also must use social media to spread the word on your question.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

This is because many moderators have a bit of OCD and tend to "over clean" the site.

There's also a flip-side to this: Dev.to takes the opposite approach, and as a result it's common to see articles that are 1:1 copies of older ones in terms of content, but rephrased by another user.

This works well for a site that puts little emphasis on browsability of older content and instead focuses more on current content and discussions, but would be terrible UX for a site that essentially acts as a massive archive of solutions for common problems.

It's easy to see this obsession with avoiding duplication as excessive from the perspective of asking a question, but it really is a major ingredient in SO's recipe for success.

Collapse
 
codenameone profile image
Shai Almog

Sorry if I wasn't clear. I meant that OCD can rub people the wrong way. However, I do consider them the reason the site works so well...

Collapse
 
miguelmj profile image
MiguelMJ

Thanks for you comment, Shai! It's good to also have the experience of a tag moderator here.

Collapse
 
andypiper profile image
Andy Piper • Edited

This is a really good summary explaining how best to ask questions on Stack. You’re right - do the research, show what you’ve tried and how you are stuck, and you will get a lot more empathy and interest in your issue. Nicely written!

Also: avoid posting images and screenshots of an error or of your code - it cannot be copied and is not easily accessible for those with screen readers.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

avoid posting images and screenshots of an error or of your code - it cannot be copied and is not easily accessible for those with screen readers.

I think a lot of beginners vastly underestimate how often people trying to help them actually start out copying their code into an editor and running parts of it to figure out what exactly happens, or even just to make sure they aren't giving a wrong answer themselves.

Experienced developers don't have magic debugging eyes either. People are bad at running code, but computers are really good at it.

Collapse
 
miguelmj profile image
MiguelMJ

Great additional tip. Thank you, Andy!

Collapse
 
thumbone profile image
Bernd Wechner

You are much kinder than I! When you write:

"Do a minimum of research first"

I sense you're very gently chiding the folk who need to sent a link to lmgtfy, while I take a much harder, but not less polite (IMHO) stance on the matter. I refuse to ask a question there or on any forum until I have researched it as deeply as I possibly can, or am faced with such a step learning curve that I figure a pointer might save he many hours of reading and study.

In fact, what I find is I only post half of the questions I write! Why? Because as often as not, in asking a question properly, in covering the clues you have, the research you have done, and what it is you're stuck on, suddenly, the nswer istrikes me ... or I find it, while I'm revisting links and writing it up my efforts.

So I would much sooner write something like:

"Research your problem well, beforehand"

The word "minimum" doesn't sit well with me. The minimum is generally 0 ;-).

Collapse
 
miguelmj profile image
MiguelMJ • Edited

Yes, you are right. When I say minimum actually I mean: "type something in a search engine". I swear there are people who don't do it. And the reason I wouldn't even expect much more than that is because a lot of beginners don't even know how to properly research their own problems... and "How to do your own research" could perfectly be another whole post. So if I get someone to just copy-paste an error message in a search bar, hey it's something.

Edit: I actually changed that section name xD That "the minimum is generally zero" stuck in my head.

Collapse
 
thumbone profile image
Bernd Wechner • Edited

Yeah, you should try watching like Arduino forums and such on different platforms. I cringe at the number of posts by noobs across the globe that are litterally "What's wrong?" and a photo of their screen. Blows my mind it really does. Still I'm not sure what blows my mind more, the incredible audacity fo the question or the people climbing over each other to answer ... I just sit back and watch. If I'm feeling a little cheeky I reply to these with "What's wrong? You posted a screenshot."

One of my favourite aphorisms is in fact: You know how they told you all through your schooling that there's no such thing as a stupid question? They lied.

In fact science itself is more about asking the right questions the right way than it is about answers as are otehr human endeavours (math, philosophy and law for example). I mean literally across all levels of inquiry. So often today online in diverse fora we can watch huge debates roaring be it on health, religion, politics, science, whatever, and because there are so few, if any, particpation requirements or barriers, people of all ages and skill levels are in the fray and almost always talking right past one another so clearly banding about ill defined, ill understood and or diversely interpreted terms and claims. And always it takes someone to stop and ask a good question ...

And in IT, the way to ask a question well is somethingt hat should be taught indeed.

You can see the frustration the broader community has around this in fact when you post an issue on github nowadays. A repo of any size or popularity generally pops up with a template right away and you spend the next 5-10 minutes finding all the info they insist you provide or they'll ignore and close your issue. You see it how on SO itself, at two tiers, first when you type the question, and then when you submit it, it shows a pile of (presumeably AI matched) existing questions asking if it's already been asked.

We see barrier rising against the endles stide of ... stupid questions ;-).

They are as old as the hills, so old in IT in fact that the Support Desk trope of course is: Is it plugged in? Have you restarted it?

I look forward to seeing if you write an article on it (it would ironically, take a little research to do well, and could in a sweet irony, be delivered as, a question).

Thread Thread
 
miguelmj profile image
MiguelMJ • Edited

It's actually as deep as you portray it. In abstract terms, a question is the realization of a problem or a deficiency. Properly asking a question (even to yourself) is half of any problem-solving process (learning included) at any scale of life, from the most personal level to any professional or scientific field, to the most high level politics and philosophy. Problem solving is asking + answering. I don't know where, but I remember reading something like "A good stated problem already has half the solution".

I believe that, for that reason, the quality of the questions asked in any space is a good measurement of how much that space could help a community (or a society) grow, so the best spaces must have high standards for their questions. No wonder why popular repos use strict templates. About stupid questions... maybe there not stupid questions per se, but stupid, inconvenient, incomplete or improper formulations in certain contexts, of course.

If asking is already the very half of the process, I don't think it's an exaggeration to say that learning to ask actually learning to learn... with all the powerful implications of that. No doubt it should be taught in IT, it should be taught in elementary school!

I'd love to write more extensively about these topics but in the end this is a tech site and english is not my native language, so I stick to this kind of posts. However, it's great to have comments like yours. Thank you!

Btw I'll keep your last idea for another article, I like it hahahaha

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

There's a few things I'd like to add based some mistakes I've seen rather often in SO questions:

Your question is not a duplicate of the proposed question

Something I'd like to add to this scenario is that any user that has already looked into a problem before asking, will have found these false duplicates and should ask their question in such a way that sets it apart from these.

In the case that the question is the same, but the solution doesn't work for them, this should also be clear if they list what they have already tried to fix the problem, ideally including a link to the other solution and maybe a quick comment on why this doesn't work.


Another thing I see all too often is users simply dumping their entire code into SO along with an error, which means even if their problem is unrelated to their specific use-case, anybody reading the code will still have to figure out what parts of the code really contribute to the problem and what is just domain logic that works.

Always reduce your problem to a simple case that can be reproduced without any dependencies and understood without extensive domain logic.


And last but not least, XY problems are extremely common on stack-overflow.

This is generally a sign that a person has attempted to solve their (original) problem and has gotten stuck somewhere in the process of what they believe is a good solution.

But this often leads to absurd questions resulting of absurd solutions to easy problems.

One question I've seen a few times now is (without any further context): I have some variables thing_1, thing_2, etc. and a number num. How can I use a variable like thing_num?

In this very simple case, it is easy to spot the real problem: The user is probably a beginner tinkering with some code and doesn't know what arrays are.

But it's not always this obvious, and in most cases, an experienced developer trying to help will only have a vague impression that what the user is trying to achieve is very awkward and probably not what they really need. This will result in a long back and forth to find out what the user actually wants to achieve, wasting everyone's time.

A good question should always provide enough context that anybody trying to help can also easily figure out what the goal is and why a certain approach was taken.

The age-old joke about stack overflow is that instead of answering questions, the question itself is often questioned. "How do I A?" "You don't. Just do B instead".

While this can be frustrating to someone that already knows they need A specifically and could explain why B won't work for them, it's also important to understand that this sort of attitude develops over a long time of being confronted with countless instances of people asking for A when, in reality, they need B, because their actual problem is C and A is just how they think they can achieve C.


So in conclusion: Explain both what your problem is, and what it isn't. Be proactive in addressing similar questions that don't apply to you, and if your overall approach seems sketchy, point out why you really do need to solve it in that specific way.

Collapse
 
miguelmj profile image
MiguelMJ

That double frame approach is actually very useful. However, being able to describe what you are trying to do and how it differentiates from other things requires an understanding of you own problem that one might unfortunately just lack. In any case, I agree with you: be proactive and address similar questions to tell what you don't find in them.

The age-old joke about stack overflow is that instead of answering questions, the question itself is often questioned. "How do I A?" "You don't. Just do B instead".

In this point I must say that this is a bad habit of some SO answering users. Most often than not, the user asking is trying to learn about A, not about B. Not all good practices are good for learning. A classic example being a question about C++ arrays being answered with "don't use arrays, use a vector object".

Not only this is not useful, but it might be harmful. It is good to learn about arrays (following the example), because even vectors use them underneath. So when I see a question about A, I try to answer it within the A context and then in a second section of your answer explain why B is a better practice and how it also solves the problem.

There are cases where the XY problem is much more clear and don't involve good or bad practices but very poor approaches, like the one you told. However, some users also assume that something XY problem very fast, in the moment they don't fully understand the context question, that not necessarily is a bad approach.

Thanks for your comment, DarkWiiPlayer!

Collapse
 
captainyossarian profile image
yossarian

The rule of thumb: Provide a reproducible example. Make sure your provided examples reflects your problem. Sometimes, when PO gets their answer they start to claiming that answer is ok in context of provided example but their original example is much more complicated. As a result it does not help and they need to update their question an provide more edge cases.

Collapse
 
miguelmj profile image
MiguelMJ

True! Sometimes a person not knowing exactly how to communicate what they need is because not even they have it clear.

Collapse
 
dagnelies profile image
Arnaud Dagnelies • Edited

IMHO stackoverflow feels like a spamming of dumb questions since ages. I somehow wonder if people answer them at all. I personally think the root of the problem is a screwed reputation system.

Basically, just asking lots of questions earns lots of reputation, especially if they are basic. On the other hand, answers are less rewarding, and especially more so if it's a deep technical and difficult topic.

In other words, reputation does not represent expertise and favors basic questions flooding. It was irritating back then, and still is.

I think if "posting" questions would cost you reputation, even minimally, and earn nothing, the questions would both flood less and increase in quality. It would also be much more encouraging to answer and reputation would be meaningful again.

Collapse
 
miguelmj profile image
MiguelMJ

I don't get the feeling that bad questions are there to obtain reputation, but I might be wrong.

Setting a reputation cost to questions is an interesting approach and I wonder if they've ever considered... although I would understand how they want to avoid that measure in a Q&A site. I feel that in some tags that would be harmful (like very new or very niche technologies) but very useful in others (massively used languages and tools like javascript and git, for example).

Thanks for your comment, Arnaud!