Codementor Events

6 Mistakes To Be Avoided While Asking Questions On StackOverflow

Published Aug 27, 2019

I've heard people claim that StackOverflow is a very closed community whose members tend to be hostile towards newcomers. These words often come from newbies to the platform. As a moderator, contributor and user of StackOverflow, I found the review and downvoting process to be a bit annoying at first, but later on I learnt why they tend to be strict and how to ask meaningful questions on that platform.

As you know, StackOverflow is the world's largest Question And Answer site for professional and enthusiastic programmers. Whenever you have a problem for which you need a solution, a google search result would always contain two or three links to related questions on StackOverflow. But how did the community gain so much of credibility and popularity? It is the same vetting process coupled with recogition of right answers and right people that has made this community what it is today.

So, how can we make the most out of such a platform? If we have a genuine problem with a language, a framework or a software whose solution can't be found through Google or authorized websites, how can we ask a question at StackOverflow without being downvoted or being asked to refer the manuals ourselves? It can be done easily by avoiding the following mistakes:

Not Googling Before Asking Questions

More often than not, if you have stuck with a problem related to a well established programming language or a framework, a simple Google/Bing Search should help you find the answer or a lead to solve the solution yourself. As a moderator on StackOverflow, sometimes trivial questions that have been answered many times put me off and I am tempted to mark them to be closed. While I want to be nice with people new to the world of programming, I would like to ask them to post questions on StackOverflow only if they have not been answered previously. This would help a lot with the page ranking and prevent cluttering the platform with a lot of duplicate questions.

Not Adding Enough Details

Ensure that you add enough details about the problem you are facing. Questions like "My class AnotherClassName.java is throwing NullPointerException. Can you please help me get rid of it?" would only invite downvotes and potentially put your question on hold marking it as "unclear what you are asking". If you need an answer to the question, you should add the content of AnotherClassName.java and the stacktrace output of the NullPointerException that you got.

Adding Only The Error Details Without Mentioning What It Is All About

Occassionally, I've encountered questions that look like this:

WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tennisCoach': Unsatisfied dependency expressed through method 'setFortuneService' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.luv2code.springdemo.FortuneService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tennisCoach': Unsatisfied dependency expressed through method 'setFortuneService' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.luv2code.springdemo.FortuneService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:667)

No head, no tail. Absolutely makes no sense without adding details on what it is all about. Unless you post the corresponding code and spring configurations, it is next to impossible for anyone at StackOverflow to find a solution for you.

Opinion Based Questions

Stackoverflow moderators don't tend to encourage questions asking opinions, recommendations etc for books or software. So, these questions may attract downvotes even if the intention behind asking them is good.

Assuming That Instead Of Your IDE, Community Members Can Debug Your Code

Some questions tend to show trivial errors that could be just a typographical one that should go away if the original poster paid attention to the error message. Such questions will definitely attract downvotes and closure. Nowadays it is difficult to find out a programming language which is not supported by any IDE that is out there. It is better to learn how to debug your code and fix things yourself before copy pasting the error to StackOverflow. You will learn more as you debug.

Questions Unrelated To Programming

Stack Exchange have so many QnA community sites which are based on different topics and StackOverflow is just one out of them. Make sure to ask the right question in the right community under StackExchange. For instance, if your question is related to Information Security, a better place to ask that would be https://security.stackexchange.com

If you avoid all these mistakes, I am sure that you will be able to ask a well-received question at StackOverflow and be rewarded with an answer and a good reputation for doing so.

Discover and read more posts from Kavitha Karunakaran
get started
post comments2Replies
Fellipe Sanches
a year ago

Great! 👏👏👏

Durai
5 years ago

Agreed