Asking for coding help

From shaderLABS

A comprehensive list of steps to ask for coding help on the internet. Following these will at most take 3 minutes and save you and everybody else trying to help hours. You don't have to follow every step religiously, but all of them can shorten the amount of time others need to diagnose your issue.

1. Post the code

People can't tell you how to fix your code if you don't show it to them, but at the same time, don't just dump your whole project into a public channel. You know your own code best, only you can tell what's relevant to the problem, only include these parts. If you have to, use multiple code blocks or comments to hint at the relationship between the code pieces.

If you can, post your code as actual code blocks. Nobody wants to download a file just to read it, especially on a phone.

2. Include the error

Error messages are there for developers to debug issues with the code. If you've got one, make sure to

  1. Read it and try to understand it (if you can't, the issue is probably foundational)
  2. Share it with the world

3. Add images

If your code compiles, but doesn't do what you want it to do, make sure to screenshot it and send it in. If you can, also include some sketch about the expected outcome. This doesn't have to be a masterpiece, you can do it in paint or for an easier experience, use excalidraw.

4. Describe what you expected

A picture is worth a thousand words, but people don't have the time to analyze your screenshots like a Picasso painting. Add context, say what you actually wanted and why the image is unexpected.

5. Say what you tried so far

Don't waste the time of others by making them go through the same solutions you've already thought of. If you tried something already, it should be part of your question.

6. Write readable code

If you want others to spend their valuable time to fix an issue you have, you must also do your part in ensuring what you do is easy to debug. Make sure your code is properly indented, uses readable variable and function names and is logically split up.

7. Avoid XY problems

XY problems are when you want to do X (e.g. fix an issue, calculate something, etc.) and you think the best solution for it is Y, so you ask how you can achieve the latter, while an alternative solution to X would be easier. This not only makes the potential solution possibly worse, but also removes a lot of context from the question, which might lead to you getting an answer slower. Always ask about the root of your problem, not a derivative of it.

8. Expect to put the most time into debugging

If you regularly jump into chat to ask for solutions to issues as soon as they pop up, you'll get people who glaze over every question you ask. Before you ask for help, make sure to actually debug the problem, try reading the code again, explain to yourself what each line does or maybe even grab a rubber duck.