Software engineers beware: the XY problem

What is the XY problem?

Someone is trying to solve problem X, and thinks solution Y would work; but instead of asking about X, the implementation details of solution Y is asked about.
In other words, asking about the attempted solution to a distorted problem, rather than the original:

<n00b> How can I echo the last three characters in a filename?
<feline> If they're in a variable: echo ${foo: -3}
<feline> Why 3 characters? What do you REALLY want?
<feline> Do you want the extension?
<n00b> Yes.
<feline> Then ASK FOR WHAT YOU WANT!
<feline> There's no guarantee that every filename will have a three-letter extension,
<feline> so blindly grabbing three characters does not solve the problem.
<feline> echo ${foo##*.}

The worst part of the X-Y Problem is wasting others a ton of time and energy in a fundamentally wrong direction.

How to recognize when falling into it

  • User wants to do X.
  • User doesn’t know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y.
  • User doesn’t know how to do Y either.
  • User asks for help with Y.
  • Others try to help user with Y, but are confused because Y seems like a strange problem to want to solve.
  • After much interaction and wasted time, it finally becomes clear that the user really wants help with X, and that Y wasn’t even a suitable solution for X.

How to avoid the XY problem

  1. Always include information about a broader picture along with any attempted solution.
  2. If someone is asking back a probing question, answer that at one level above the current discussion.
  3. Go over other solutions you have tried, or ruled out.
  4. If none of above worked, smile and get over the sunk cost.


Wikipedia: XY problem
Stack exchange
The YX problem
The XY Problem in Product Management

Share Comments