How to ask good questions as a developer
Tags: beginners, devtips, learning, webdev
Published: 2018-09-17 16:33:55

---
title: How to ask good questions as a developer
cover_image: https://thepracticaldev.s3.amazonaws.com/i/4j4eupiyrcjiwb9sji95.jpg
published: true
description: Knowing how to ask questions in the right way is a key skill for life in general. Here are some tips on how to ask good questions as a developer.
tags: beginners, devtips, learning, webdev
---

Knowing how to ask questions in the right way is a key skill for life in general. A well-structured question will, more often than not, return a useful, direct answer. 

When it comes to coding, there are some steps you can take to increase the chances of getting a good answer.

So, one of the skills I try to improve with my students in class is how to ask good questions when they run into an issue.

Here are the main points I teach them:

## Do the basics
The very first items on your good-question-asking-quest (⚔️) are the basics. 

In the early lessons of an in-person course, an instructor might talk you through the solution, while fixing your code. But, in the big bad world of online communities not doing at least the basics is often like a red flag to a bull. 

### Check your code editor for typos and syntax errors
Syntax highlighting is a powerful ally when spotting simple typos. 

Especially for any Brits out there:

![Image of code editor highlighting the incorrect spelling of color in CSS](https://i.imgur.com/7nPKFnI.png)

In the early days, the majority of your errors will be typos and syntax errors. These should be a quick fix with the help of your trusty code editor.

![Image of a syntax error in CSS where the developer has missed out a semi-colon](https://i.imgur.com/04QU9o8.png)

### Check for written errors
If the language you’re writing provides written errors, check the console/logs.  Read through the error to see what and where the error is. 

## Try to understand what’s going on
Once you’ve done the basics you’ll be a little more informed on what the issue might be.

Now it’s time to read through the code line-by-line. Use any debugging tools available for the language and dig into the problem. 

Take your time here. The deeper your understanding of the problem, the more hypotheses you can create. This will, in turn, lead to a clearer question.

If it’s a user interface (UI) issue, use your browser's developer tools. Toggle styles off and on and see which ones are being over-written by others. 

Otherwise, use debuggers and inspect the values of variables. Do they match up to what you them to be? Is something showing as `undefined` when you expect it to have a value? 

If necessary, comment-out blocks of code to zero-in on where the issue is.

## Do a few Google searches
By now, you should at least have an understanding of the problem. This means you should be able to structure a focused question. Before asking anyone else for help, head to Google to do some searching.

Google is a developer’s best friend. Even experienced developers need to Google their way out of problems on a regular basis. Good developers are also, very often, good Googlers. 

The basic way to structure a decent Google query is as follows:

> language/library/framework + spoken word question **OR** error message

Here are a couple of examples:

![Screenshot of a Google query saying "JavaScript how to filter array"](https://i.imgur.com/LwN6Ujg.png)

![Screenshot of a Google query asking "React how to pass props"](https://i.imgur.com/esyf0AS.png)

Make sure you do a few different searches. Read through any results that seem appropriate for your issue. With a bit of luck, someone before you will have had the same problem and had their issue resolved.

## Recreate the issue away from the project
If you still haven't fixed your problem, try recreating the issue away from the project. This is especially helpful if you’re facing some weird CSS problem. In this case, you can [head to somewhere like CodePen and share your broken code snippet](https://codepen.io/).

Being able to separate your broken code from the rest of your project has a couple of benefits: 

- It will help you focus on the issue 
- It will help anyone else who gets involved fix the issue faster

This comes back to valuing other people’s time. It will take them less time to go through a succinct code snippet than your entire codebase.

## Prepare to share your code
OK, so you haven’t been able to fix the issue by yourself. No worries! Everything you’ve done until now has laid the foundation for being able to ask a great question. 

But, before you bring someone else in to help you out, there are a couple of things to do:

### 1) Make sure your code is well-formatted
If you’re a disciplined developer, who has well-formatted code, then high-five ✋

If you’re not, then now is the time to get your code looking pristine ✨.

Consider using linters. Linters enforce good practices by issuing warnings/errors for poorly-formatted code. You can even make it so that you can't push code that has linting errors.

At the very least, [add Prettier to your editor](https://prettier.io/) and let it do the formatting for you.

Bottom-line is: nobody wants to sort out the formatting of your code before they can even start helping you.

### 2) Ensure the code you’re sharing recreates the error
Before you share your code, make sure it recreates the issue you’re experiencing. This should go without saying, but it will be extremely tough to help you if the code you’re sharing doesn’t recreate the error.

If the code requires a few steps to get up-and-running, be sure to include those steps when you share the code.

## Show the efforts you’ve gone through to solve the problem
At this point, you’re either raising your hand in the classroom or heading to somewhere like StackOverflow or a Slack channel to get an answer online. 

When asking, it is crucial to go through the steps you’ve taken so far to resolve your issue. Provide anyone who might be able to help with as much information as possible to clarify your issue. 

Here’s some of the information you should be sharing:

- Your understanding of the problem. This could be a few different hypotheses by now. It is important that you articulate what you think the issue might be and what you’ve done to try to fix it.
- Screenshots of your issue/error. If it's a UI issue, annotate your screenshot to highlight the problem.
- Code (preferably in a sandbox environment) that recreates the issue.

Read and re-read your question, if posting online. Be sure that you are providing as much detail as you can to help others help you. 

A vague question is much more time-consuming to answer online than in-person.

## Keep everyone updated
If you’ve posted the question online, you might resolve your issue before anyone else has time to answer it. If this is the case, be sure to post your own answer to your question. 

It may seem strange to answer your own question online. But, people do it all the time and it could help someone else in the future.

## Thank anyone who tried to help you
**This. Is. Crucial.**

Thank **everyone** who tried to help you. Even if they didn’t actually help resolve your issue. They’ve taken time out of their day to help fix your broken code. Show your appreciation 🙌

- - - -

Do you have any tips or tricks about asking good questions that you’d like to add? Please write them in the comments.

Want to say hi? [Follow and tweet me @frontendmentor on Twitter](https://twitter.com/frontendmentor).