DEV Community

Cover image for Learn how to ask good questions. Be aware of the XY Problem.
Davide de Paolis
Davide de Paolis

Posted on

Learn how to ask good questions. Be aware of the XY Problem.

Have you ever spent hours trying to solve a problem only to find out that what you fixed was not really the problem?

Have you ever asked someone for help and got many more questions in return, questions that seem to bring you away from your problem and found that annoying?

Well, probably you, like me many times, have been wasting time on the wrong problem, asking the wrong questions. How is that?

It is because of the XY Problem ( and our lack of "asking good questions" skills)!

The XY problem

The XY problem is asking about your attempted solution rather than your actual problem.

What does that even mean?

Imagine your car does not start.
You open the hood, and for some reason you assume it's a problem with the battery.
Now you focus on the battery, how to recharge it, or replace it. And start calling your friends for advices and help. Do they have jumper cables? Where can you buy a new one? Is it easy to replace it on your own?
Once you have done or try it, you realise that the car does not start anyway. Because the problem was not the battery.

Of course I am not saying the problem was trying out different solution or starting with assumptions. The problem was in the way you asked yourself - and others - questions.

If you don't know much about cars, probably, the first question to ask your friends should have been - hey, my car does not start, it makes this sound, and I have this light on, what could it be?

instead of Hey, my car battery is down, do you have cables or do you know how to replace it?

By asking directly about the battery, you have hidden the context and therefore made impossible for your friend to understand the real problem and help you.

This is the XY Problem.

The XY problem obscures the real issues and may even introduce secondary problems that lead to miscommunication, resource mismanagement, and sub-par solutions. wikipedia

You want to fix X, but end up asking question about Y.
Y could be your wrong assumption, but often could be something that you are stuck with, a new problem that you have with the wrong solution you are trying to implement.

Always describe what you want to fix, not what (you think) the problem

In this example the developer needed help to find a way to retrieve the extension of a file. (given my-file.doc the desired output was doc, given my-picture.jpg, the output should have been jpg). So the developer asks advice about to split the filename to get the last 3 chars.

This is of course the wrong approach, because there are file extensions that are longer than 3 ( think of .html, .json, or .jpeg).

XY Problem

Hadn't the more experienced dev ask why the junior dev was looking for such a solution, time would have been wasted, and unexpected behaviour and bugs very likely introduced in the code.

How to ask better questions?

“We can be too quick to blurt out what we believe are the correct answers, when more value can be gained by searching for a better question. A questioning mentality is far more effective than a knowing mentality. Once we have declared an answer, our biases towards commitment and consistency cause us to defend our answer, wasting energy that would be better applied to exploring alternatives.”

I love this quote from Laurence Endersen because it summarises perfectly the importance of a critical thinking and questioning mindset.

Be humble, don't take anything for granted, always reevaluate your answers, and learn to ask questions.

Critical Thinking is a broad topic for another post, here though I'd like to list some advice to avoid the XY problem and start asking better questions.

The FAQs in StackOverflow give already some useful tips to properly form a question, which we can use even if we are asking to friends or colleagues, not just to strangers on the internet:

Once you’ve finished writing your question, read it through. Imagine you were coming to it fresh, with no context other than what’s on the screen.

  • Does it make sense?
  • Is it clear what’s being asked?
  • Is it easy to read and understand? Are there any obvious areas you’d need to ask about before providing an answer?

This is quite generic advices but it is worth to always put ourselves in the shoes of how is going to help us. They don't know our problem, don't know the context. Is the question providing the necessary information?

Here some more valuable advice on explaining first the problem so that none is mislead:

  • Be precise and informative about your problem
    Describe the symptoms of your problem or bug carefully and clearly.

  • Describe the research you did to try and understand the problem before you asked the question.

  • Describe the diagnostic steps you took to try and pin down the problem yourself before you asked the question.

  • If at all possible, provide a way to reproduce the problem.

  • Do the best you can to anticipate the questions anyone trying to help you might ask, and answer them in advance in your request for help.

I'd like to stress a couple of point here:

  • Describe the problem's symptoms, not your guesses, (especially because, if your diagnostic was so good, why do you still have no answer?)

  • If there are other solutions you've already ruled out, share why you've ruled them out

I have experienced the consequences of poorly asked questions and of the XY problem often even before working as Software Engineer, when after high school I was working at the Hotline of a Mobile Company: as soon as I was answering the call, the customer started ranting and asking me how to solve their problem, getting upset at my questions to frame it.

Tell me what is happening in detail. Don't tell me what you think is happening.

Recap

Getting stuck on a problem is frustrating, asking for help can be tough ( when you are alone working remote, when you just joined a new team or simply because showing our flaws and shortcomings is always uncomfortable).

But we should never be afraid of asking questions or asking for help,
Provided that you are not just being lazy and you did your homeworks.

  • Respect other people's time

There is plenty of helpful people out there, there is no reason to be afraid to ask, but ask properly.

A mentor, a teacher, a senior team member is not there to solve your problem. They are there to help you find the solution or explain you why something is a solution to your problem.

  • Don't expect to be spoon-fed with the solution

And once you got an answer, you got helped, and were able to solve your problem, don't just move on and forget.
Try to understand why that answer is a good solution to your problem.

Learn something out of it.

  • Reflect and let your learnings soak up.

If you find this post useful you can find some more thoughts about being proactive and asking questions in this post.

Hope it helps


Photo by Camylla Battani on Unsplash

Top comments (0)