Template for Asking Programming Questions
Thank you for your continued support.
This article contains advertisements that help fund our operations.
Table Of Contents
This article summarizes a template for asking programming questions.
Question Template
- What you are trying to do
- A screenshot of the current display (or error screen)
- Code
- What you have tried
- Logs (if any)
- URLs of other reference sites
What You Are Trying to Do
Express what you are trying to do in one sentence.
Examples:
- I want to resolve the ⚪︎⚪︎ error.
- I want to implement an image download function.
Screenshot of the Current Display (or Error Screen)
Screenshots are very informative.
Summarizing error messages in text can be frustrating; it's much better to send the error message as-is. Screenshots offer valuable clues, especially from the error context and other information on the screen.
For example, sharing a screenshot of a bug like "the page is not displaying" could reveal a simple mistake, such as using the wrong URL. This can be harder to catch when information is shared as text.
Additionally, instead of summarizing the error as "syntax error," a screenshot might show a more specific issue like:
"There's a syntax error on line 45 of the HomeController."
As you gain programming experience, you'll extract more insights from the screen, leading to faster problem resolution.
Code
Share the code you’ve written.
It’s best to send only the code relevant to the issue, but if you're unsure, it's okay to include more code than less.
What You Have Tried
Share your output and what steps you've already taken to troubleshoot.
When reporting an error, explain whether the bug occurred in newly written code or in code that was previously working. Including a timeline of events makes it easier to understand.
Example:
I was implementing authentication when I encountered the error.
php artisan **_
php artisan _**
php artisan **_
php artisan _** // Error occurs here
I also changed the config file \*\* and tried again, but the error message didn’t change.
Bad Example:
php artisan \*\*\* // Error occurred
Logs (If Any)
Logs can help identify what error is occurring. For example, when asynchronous JavaScript is communicating with the server and an error occurs, the logs may reveal what went wrong.
Share the logs that appear when running the program, including information from the browser console, if applicable.
URLs of Other Reference Sites
Attach the URLs of any reference sites you used for your implementation.
Concerns from the Answerer’s Perspective
Answerers generally prefer to avoid speculation. The challenge for the answerer often starts with figuring out what actions led to the error, so the more information you provide, the less guesswork is required.
Code Should Be Copyable
When sharing code, provide it as text that the answerer can easily copy and paste. Sharing code as screenshots prevents the answerer from creating a base to work from.
Error Screens Should Be Screenshots
Screens provide a lot of information. Nowadays, it's easy to share images via communication apps, so sending a screenshot is both the easiest and the best method of sharing this information.
Summary
I’ve created a template for asking programming questions.
Even beginners often ask clear, concise questions, which I think is impressive, especially given their lack of experience. Occasionally, someone might say, "A real engineer should be able to solve this with just the status code," but those cases are rare.