Code n00b: How to Answer Stack Overflow Questions Without Being a Jerk
Thankfully, a few other users dropped into the fray, actually answered her question, led by example about Stack Overflow posting etiquette (for example, include code snippets) and nicely encouraged her to keep participating.
What struck me was how the responders basically had the same agenda: telling a n00b that she needed to reformat her question. However, there was a night and day difference between how they went about doing this. One approach was terrifically helpful and encouraging. The other, not so much. Which has inspired me to write this list of handy tips for answering n00b questions on Stack Overflow and/or your user forum of preference.
Step 1: Have some actual experience with the problem they’re describing/requesting help with.
That one time, four years ago, when you read that thing? That doesn’t count.
So if you are going to weigh in on, oh, for example, the most popular question ever asked on Stack Overflow (“How do I convert a String to an int in Java?”) please actually be a Java programmer.
Step 2: Actually answer the question.
Ok, so maybe the answer to the query at hand is incredibly obvious to you. Something every coder should already know. Awesome! But pretty please keep commentary about this to yourself. The person knows they are a n00b already. You pointing out their n00b-ness, or pointing them to the standards docs (like you’ve read them — who TF reads those things, like, ever?), or telling them “Google is a thing, you know” — achieves exactly nothing. If you are going to reply to a post, how ‘bout actually, you know, helpfully answering their question?
Step 3: Aaaand maybe make that a practical answer.
We are all super impressed with your ability to bring out the most obscure use cases and program around those. Ditto handling every conceivable exception. But when the question at hand is
How can I convert a String to an int in Java?
My String contains only numbers, and I want to return the number it represents.
For example, given the string "1234" the result should be the number 1234.
Your answer should maybe be
String myString = "1234";
int foo = Integer.parseInt(myString);
And not some page-long codeset that does everything manually, throws in an ASCII table, and oh also works for base 8 and 16. (An actual response to the referenced Stack Overflow post, about which one of the commenters wryly notes, “I suppose this answer is for curious fellows.”) Yes. we see how clever you are. No, this is not helping so much.
Step 4: Provide your expertise, even when it’s not asked for.
Be sure to use an assertive tone when you do this. Especially if the original poster shows insecurity or just sheer ignorance. Just jump on in there and tell them everything they should already know, letting them know how ridiculous they are to even have this question in the first place. Or you could try the oblique route: “Never saw THIS before,” “Of course not,” and “Whaaaaaat?” are good options to convey the ridiculousness of the original poster’s question—and your own superiority. You’ll get mad respect.
Seriously, though, if you think a query is ridiculous or simply doesn’t belong, that is what the “offtopic” and downvote buttons are for.
Step 5: Speaking of downvoting…
It’s incredibly discouraging to be a new user, post a question, and immediately get hit with “topic closed.” Even when it’s a many-times duplicate question, don’t bar people from answering it. If you truly wish to shut it down, give a brief explanation why and the courtesy of pointing to someplace they can find a good answer, if you’re not going to give one. Seriously, one of the hardest parts of being a code newbie is gaining enough knowledge to even to ask a good question in the first place.
Yes, some questions are just lazy, and even trying to get you to do their homework for them. But I have seen many, many other questions that I thought were reasonable but nonetheless inappropriately shut down, without explanation or advice for what the OP could do.
As a Stack Overflow n00b myself the most frustrating thing I experienced is being voted down without explanation. I go there to get — and, as I build experience myself, give — help, not gain reputation. I try to be helpful in return. So if I venture an answer and it is deemed unhelpful I would like to know why so that I can do better next time.
Step 6: Cross the line once in a while. It keeps people on their toes!
Fortunately, there is an official ethic of tolerance and civility enshrined in the Stack Overflow code of conduct, i.e., the “Be Nice” page (which specifically mentions being kind to new users). This includes not doing the following, no matter how ripe the temptation:
- Name-calling. Focus on the post, not the person. That includes terms that feel personal even when they’re applied to posts (like “lazy”, “ignorant”, or “whiny”).
- Bigotry of any kind. Language likely to offend or alienate individuals or groups based on race, gender, sexual orientation, religion, etc. will not be tolerated. At all. (Those are just a few examples; when in doubt, just don’t.)
- Inappropriate language or attention. Avoid vulgar terms and anything sexually suggestive. Also, this is not a dating site.
- Harassment and bullying. If you see a hostile interaction, flag it. If it keeps up, disengage — we’ll handle it. If something needs staff attention, you can use the contact us link at the bottom of every page.
Step 7: Be the change you want to see.
I know all too well what it’s like to flail around as a brand new Stack Overflow user. Overwhelmed by all there is to learn about actual programming, trying to ask for help, and going about it the wrong way… So you end up asking a poorly framed question, and then get burned by comments such as:
- “Have you even tried to solve your problem?”
- “Nobody is going to do your homework for you. Go do it yourself.”
- “Dude, do you even Google?”
Such comments seem to be standard operating procedure on many new users’ posts. What’s going on here? What happened to the Be Nice to n00bs policy?
Yes, bad questions are posted hundreds of times a day, and it is tiring and annoying explaining over and over why a question is a bad fit for Stack Overflow. But if you’re going to invest effort in the question, why make it rude or denigrating? If you really don’t want to explain, just move on and let someone else do it. Save the flame wars for the Vi vs. emacs forum.
But: consider this. It takes the same amount of work to simply tell the user what they did wrong — which helps them do it right next time. And possibly helps make us all better programmers, and maybe even better humans, in the process. Which is what we all want, right?
Catch Michelle Gienow’s Code n00b column every other Friday, exclusively on The New Stack!
Feature image via Pixabay.