The Art of Asking Questions as a Programmer

Yesterday, I saw a friend in the group discussing the art of asking questions as a programmer, and I would like to share my own thoughts.

Encountering problems while programming is completely normal.

Solving problems for others can also improve your own skills, but asking someone to answer a low-quality, thoughtless question is undoubtedly a waste of time for both parties.

Image
Image

Before asking a question, make sure that:

  • You have already searched using foreign search engines (foreign resources are relatively more abundant than domestic ones)
  • You have consulted the documentation of the relevant tools
  • You have attempted to solve the problem on your own
  • You have ruled out some common external factors, such as network issues, hardware problems, or restarting the system

Don't think that search engines can't find anything; with 7,200,000,000 people in the world, someone is bound to have encountered the same problem and posted about it.

Let’s talk specifically about search engines. Avoid using question words like "how" or "where"; instead, use keyword searches. For example, if I want to know how to list all users in MySQL,

√ A good approach would be:

Image
Image

❌ Rather than:

Image
Image

This principle applies to most search scenarios.

When asking a question, make sure to provide:

  • A description of the relevant context, including the system, libraries/tools, language, etc.
  • The actual behavior
  • The expected behavior
  • Provide a minimal reproducible example if necessary

After asking a question, you should:

  • Actively respond to requests for additional details
  • Follow up with others once the issue is resolved

Most technical people are still willing to help others, provided that the questioner demonstrates a certain level of politeness and skill.