๐Ÿ’ฌ Asking Questions

Asking Questions systematically

Often trainees at Code Your Future find it difficult to get help. This is because we are dealing with complicated questions that people need lots of details about to be able to answer.

activity

If you have not completed the Asking Questions workshop, find a small group of people to do that together before reading further.

It is important to understand how your current mental model helps you to ask a good question.

Building your mental model

As we learned in the Asking Questions workshop, it is important to share your current mental model to help you ask an effective question ๐Ÿงถ ๐Ÿงถ effective question Questions are effective when they are more likely to receive an answer. .

Before asking a question, make sure that you have:

  1. Made a prediction and explain why you think that will happen
  2. Run the code
  3. Compared your prediction against what actually happened

Now, write up your mental model using this format:

  1. What I did
  2. What I expected
  3. What actually happened

Sharing your mental model

To be able to fully understand your mental model, volunteers need to have context. So it’s important that you share at least the following information:

  • The coursework task that you’re working on. It’s helpful to include a link to the task
  • What isnโ€™t working in your code, or what you donโ€™t understand
  • What you have done so far
  • What you predicted would happen before you ran the code
  • What actually happened
  • The exact code that you are running. Don’t include a screenshot of your code, see sharing code below

Question template

Use this template:

question

Coursework:

// Write which coursework you’re working on here

Problem:

// Describe the problem you have

What I did:

// Describe what you’ve done so far here

What I expected:

// Describe what you predicted would happen here

Code:

// Include snippet(s) of code that you are running here. See sharing code below

For example

question

Coursework:

HTML-CSS Module: Form Controls

Problem:

The headings on my website don’t look right.

What I did:

I’ve tried to use a H1 tag but it doesn’t seem to do anything.

What I expected:

The heading should be much bigger than the other text on the page.

Code:

https://github.com/CodeYourFuture/Module-HTML-CSS/pull/1234

Sharing code

Your question will be much more likely to be answered if other people can quickly read and understand the code, so your code should be formatted nicely.

Never use a screenshot

A screenshot is the worst way to share your code!

  • A screenshot is very small so the people trying to help you have to zoom into and pan around to read it
  • If you have more than 1 page of code then the people trying to help have to switch between multiple screenshots
  • Screenshots aren’t accessible, so some people can’t read them

It is always better to share your code as text.

GitHub PRs are best!

The best way to share your code is using a GitHub pull request. This is because:

  • They contain all of the code that you are running
  • The code is shared as text so that it is easy to be read by other developers
  • The code should be formatted ๐Ÿงถ ๐Ÿงถ formatted Formatting is the spacing around the code itself, which makes it easier to read. nicely, if you have the CYF VS Code extension pack installed. (If you don’t, please install it now!)
  • Other people can leave comments on specific lines of your code to ask questions or point out problems

Before you ask a question, make sure you commit and push all of your changes so that the PR contains the same code as what is on your computer.

remember

You do not need to complete a coursework exercise before making a pull request. You can always push more commits after you have solved the problem.

Slack

Sometimes it’s not convenient to share a GitHub PR, so code can be shared on Slack directly. Here’s some rules for sharing code on Slack:

  1. Never share a screenshot of your code (we really mean it!)
  2. Copy/paste your code into a code snippet. This will make your code look like code, not just a “normal” message
  3. Alternatively, if you need to share a larger chunk of code try copy/pasting your code into a Gist and sharing the link

Checklist

Before asking a question check in with yourself and make sure you have done the following:

exercise

  • Done some research myself
  • Explained what Iโ€™ve already tried to solve my problem
  • Stated what I expected, why I expected it, and the actual results
  • Formatted my code
  • Checked my spelling and grammar
  • Pasted the exact, complete error message, if there is one
  • Read my whole question carefully to make sure it makes sense and contains enough information for someone coming to it without any of the context that I already know?

After you’ve asked your question

exercise

  • Are you monitoring your questions and replying to people giving their time to help you?
  • Have you been asked for a Minimum Reproducible Example?
  • Have you posted an easy to understand answer to your questions that includes everything you learnt

Conclusions

By completing all of these steps you make it really easy for you to get help quickly and for other students to learn from your question. Together, you and your colleagues will build up a shared knowledge base you can search and share.

You also make yourself a better developer. Describing problems clearly and systematically is an important skill for a developer.