Using Stack Overflow Like a Pro

Bloc
News on the Bloc
Published in
7 min readDec 16, 2016

Developers and designers of all skill levels spend time on Stack Overflow. If you have a technical question — simple, complex, or anywhere in between — you can ask it on Stack Overflow. If you Google an error message from some code you’ve written, a link to a Stack Overflow page will often be one of the top search results.

Why You Should Learn Stack Overflow

Stack Overflow has a large and vibrant community which is eager to help, making it one of the fastest ways to get quality answers to technical questions. Asking and answering questions on Stack Overflow has many derivative benefits as well. Stack Overflow is a canonical, public site that almost everyone in the software world knows about. Having an active presence on it — answering or asking questions — reflects well on you as a developer or designer.

You may be thinking: “How does asking a question reflect well on me?” On Stack Overflow, question quality is tightly monitored, which forces you to ask good questions. Asking good questions requires clear thought and good communication, and is a skill all professional developers need to be good at.

Knowing how to structure an effective question is more valuable than any specific technical skill.

You may be surprised by how much you can learn from asking thoughtful questions. Writing coherently about a problem is the best way to wrap your mind around it — even better than talking through it. You will find that in the process of writing a thoughtful question, you often discover the answer yourself.

Let’s discuss some specifics of asking and answering questions, and why it’s an important part of the Bloc experience.

Asking questions

Getting an answer on Stack Overflow may be the goal when posting a new question, but the journey is just as valuable. When you ask a question, you must follow the site’s guidelines. If your question breaks the guidelines, it will likely be closed by a moderator. In other words, in the world of Stack Overflow there is such a thing as a bad question.

How to Ask Good Stack Overflow Questions

The guidelines are the definitive source on how to ask a good Stack Overflow question. But we’ll give you some pointers and examples nonetheless.

  • Always look for answers before asking your question. Are you getting an “undefined method ‘each’ for nil:NilClass” error? Searching Stack Overflow or Googling it will provide you with a host of answers to similar questions. You may find what you’re looking for with a couple of simple Google searches.

Stack Overflow users will often link to answers to identical questions, and occasionally down-vote or close questions deemed to be redundant. This may seem pedantic, but it’s an attempt to keep the signal to noise ratio positive. A positive ratio is a good thing for everyone using Stack Overflow, even if it’s frustrating for new users at first.

Your question may occasionally be down-voted by a member who thinks your question is simplistic. Unfortunately, down-votes may sometimes be accompanied by a curt comment. Thoughtful questions and politeness help to ward off rude responses, but if you do receive them, you should not take them personally.

  • Before submitting a question, read it to yourself, out loud. Make sure that it has sufficient context to be solvable by someone without specific knowledge of your application.
  • Share your process and attempts at solving the problem. Stack Overflow users are more likely to be helpful if they feel like you’re trying hard and asking intelligent questions.
  • Remember that someone else will be volunteering their personal time to answer your question. Give them the respect they deserve by asking the best question you can.

Thank whomever helped you, and up-vote their comments. Always click the checkmark next to their answer if it solved your question.

  • Be specific, particularly in the title. “Undefined method” is an example of a bad title. “Undefined method ‘each’ for nil:NilClass in my Rails view” is an acceptable title. “How to build complex data relationships” is another example of a bad title. “How to debug a polymorphic relationship” is acceptable, because it shows that you may have tried to solve your problem. Note that this title lacks concrete detail, so even though it’s acceptable, it could still get down-voted. Naming things can be hard, so treat your question like a tiny blog post. Blog titles require thought, and so should questions on Stack Overflow. Try to be overly specific when you’re titling questions.
  • If your question is answered, but you then encounter new and different errors, start a new post. It’s hard to get help if you ask “nested-questions” that might be out of the context of the original question.

When writing questions, pay attention to the autocompleted previous question suggestion drop-down. There’s often a chance that your question has been asked before:

Providing Context

It can be hard to know what sort of context is relevant. Inevitably, you’ll miss some relevant context and be asked to add it. Here are some prompts to increase your chances of giving the right information the first time around:

General context

  • Provide all relevant files, output, and instructional material. Err on the side of too much information.
  • Provide the constraints. In a program like Bloc, you may be asked to solve a problem using the particular tools to which you are being introduced. Clearly state what can and cannot be used to answer your question.
  • Provide background about your level of knowledge, so you don’t get an answer that is too advanced.
  • Show your research. Link to articles or Stack Overflow posts you’ve looked at.

Being a beginner will give you some leeway, but it is no excuse for not doing research before posing your question. Even if you’re a beginner, make your research attempts clear.

  • In addition to your research history, discuss your attempts to solve the problem, and always show your code.

On Stack Overflow, a question without indication of prior work or research runs the risk of being down-voted and closed.

For errors

  • Provide the complete error message.
  • Provide the complete error “stack trace”. This is often found in your server logs.

Stack traces may seem like impenetrable nonsense, but they contain a good deal of helpful information for other people who are trying to assist you.

  • Show the file referenced, and state which line is called out by the error.
  • Provide an account of what causes the error. Did the error happen on your local server, or in your production environment? Did the error happen when you clicked on a specific link? These are all helpful things for other people to know.
  • Show the contents of files or methods that seem relevant or are mentioned in the error trace.

This post gives a useful example of good context. Note, however, that the stack trace is incomplete.

Formatting

Stack Overflow formatting is similar, but not identical, to Markdown. Code blocks are indented four or more spaces, rather than fenced in with back-ticks. Images should be linked to using the formatting bar above the text box. When you’re finished with a question, tag it with the relevant labels, and then submit it.

Questions on Stack Overflow are sent back to the top when edited, so if your question hasn’t been answered for an hour or two, make a useful edit, or update it with another one of your attempts to solve the problem.

Examples

The following, found after a brief search, exemplify good Stack Overflow questions:

  • Project Euler #15 — The questioner provides context with their code and their thought process for tackling this problem. The updates keep the question current and provide more context. Note the quality of answers — they are directly related to the quality of the question.
  • No route matches error when route exists — The questioner thinks through the relevant context and explains it clearly. As a consequence, someone was able to respond to the question in an hour.
  • Angular.js: Uncaught error, no module: myapp — This questioner has a variant of a common problem. To be clear that he’s looked at other solutions and requires unique help, he links to the other solutions he’s tried. Then, he provides his relevant code and context.

Answering Stack Overflow Questions

Stack Overflow has guidelines for answering questions as well. There are many great reasons to spend time answering questions on Stack Overflow:

  • It benefits your online reputation, which is important to potential employers, customers and clients. Stack Overflow has a careers and resume service integrated with its Q&A site, making a Stack Overflow reputation useful for employment purposes.
  • It builds a network of technologists you can reach out to.
  • It provides an opportunity to expand your familiarity with specific technologies, exploring them in new contexts and ways.
  • It forces you to think critically about a problem, and explain a solution in a pragmatic way. Once again, this is a communication skill and is as important as any technical skill.
  • It allows you to help someone in need. It should feel good to give back!

Your Stack Overflow reputation dictates what you can do on the site. For example, you must have at least 15 reputation points to up-vote and down-vote questions, comments, or answers. You are awarded reputation points when you ask and answer questions.

Using Stack Overflow for Bloc

Stack Overflow is a great tool to use during your Bloc course. We’ve implemented an interface that allows you to submit Stack Overflow questions, so that they’ll be seen and answered quickly. Mentors, other students, and Bloc staff monitor the Stack Overflow question page.

--

--

Bloc
News on the Bloc

An online education company with coding and design programs built for outcomes. Check out our publication, News on the Bloc, as well as our website, bloc.io.