[0]: https://meta.stackexchange.com/questions/66377/what-is-the-x...
[0]: https://meta.stackexchange.com/questions/66377/what-is-the-x...
Or when X needs to be done but instead all the comments hector the question with useless criticism.
If there truly is a circumstance which makes X the right solution, then that might warrant a new question being posted with the additional context to make that so. But I suspect it's much more often the case that the asker is simply being stubborn and doesn't want to change their plans.
Obviously not the ones making the “why are you $X” comments in this case though.
Obviously it's possible for non-experts to post authoritative-sounding answers on questions that they don't really understand, but I think that is a different category of problem from the "XY-problem" style answers.
But the answer to the question "How to do X?" really shouldn't include more than a passing reference to "Here's how to do Y." If X is impossible, then that is of course the answer.
And as others have indicated, the most frustrating scenario that happens over and over is that once the "How to do X" question is asked, you can never get an answer to that question if the original poster relents and agrees that what they really need is an answer to "how to do Y?".
Would you be willing to be responsible for the fallout of answering that question any other way besides "use parameterized queries instead"? Do you really think that should only be mentioned as a passing reference?
And the passing reference to the potential misuse here can be a big bold statement at the top of your answer.
And since every question about such things get auto corrected to use parameters (which doesn't help, since it's something else entirely), You have millions of buggy self glued sql queries allover code bases. (but hey most of them are using parameters, so yay - progress)
But yes, it can be a lonely game :)
And if you are really trying to solve Y, it's not hard to specify that in your question (I know I can solve X without solving Y, but I don't want to solve X, I want is to solve Y in this case). I wouldn't say "there's nothing worse" than that; it's a minor inconvenience.
Then either: I do know what I'm doing, and my explanation satisfies people, and they try to work on Y, or: it turns out I was indeed wrong, and I should have solved X some other way.
Either way it's a win for me (if anyone bothers to answer the question).
But it can be hard for either new people, or people who don't know the domain well enough to even know that it could be an XY problem.
It’s analogous to asking “why does pizza taste metallic to me?” and getting “why are you eating pizza?” as a reply.
I would definitely ask them why they think they need to take aspirin with whiskey for their hangover.
If that input indeed did cause that result, you'd expect a forum of human beings to have responses like this:
"Holy shit that result was most surprising! I have to re-evaluate my entire life now. Just curious, though-- what made you decide to lick aspirin and sip whiskey?"
Any response that didn't explicitly confirm the result would be signalling to the world that they are either a troll or a boring contrarian.
Similarly, `man` isn't ever supposed to output `gimme gimme gimme` as reported. That is surprising behavior. And that surprising behavior is trivially reproducible by the likely harmless act of setting your machine to the time specified and running it.
Thus, the fact that this reported case was actually a feature of `man` outs all the people who posted non-sequiturs as low-effort cranks. (Low-effort because they didn't even take the time to run a trivial test.)
Edit: just to be completist about it-- I suppose a respondent in either case could simply challenge the veracity of the report. But that's not what we're talking about here AFAICT.
Edit: to make a steelman argument here-- maybe not cranks, but people who have, for whatever reason, fallen prey to the act of low-effort crankiness.
The answer could have been simply: "It's an easter egg. It's from an Abba song." Done. End of discussion, it answered the question.
But by probing how the user wanted the thing to work, and why it was breaking his tests, and that it was actually happening when he used `man -w`, the maintainer actually understood that it was not a harmless easter egg, and fixed it so it didn't happen when called with -w.
When I am asking: "Whenever I eat pizza in the morning, it tastes metallic to me. Has anyone an idea why that could be?"
I dont want someone to answer: "Why are you eating pizza for breakfast?"
This answer is worth nothing. Actually its even worse, cause answering it costs time.
I, for one, am still curious why OP is running a test where they call `man` with no input and fail on different stderr.
Of course it doesn't, when your "specific" analogy isn't nearly analogous to the situation.
It is honestly a lot more likely that the reason man is outputting ‘gimme gimme gimme’ at a particular time of day is something to do with your crazy test setup than that it is a feature of man.
So for the pizza analogy, think of it more as ‘pizza sometimes tastes metallic to me when I cook it under the hood of my car’. The car situation seems likely to be relevant. It would be surprising, when someone asks a question like that, to discover that it’s actually because the frozen pizzas they buy when they drive to the parking lot where they then cook them under their car hood actually contain iron filings that were put there deliberately by the manufacturer.
If you don't want focus on the details, then don't provide them. If you provide them, it has to be because you think they might be relevant. And then it's relevant for people to ask for further details.
So far you seem to be the only one failing to grasp the original point. Your misunderstanding of the analogy does not transform it into a misrepresentation.
The XY problem in practice: Someone doesn't know the answer to your question so they randomly choose a response from the ten things they do know.
Also: If we're calling it the "XY problem," does that make it mansplaining? (XY? Get it? Sorry.)
If the advice is really that bad or uninformed, then it should just be downvoted. That's not really related to the "XY problem".
Ever heard of a thing called signal to noise ratio?
Still got idiots replying that I shouldn't be doing what I want to do in one line.
If it's really true that the conventional wisdom about Y is just wrong, and X really is better in some cases, then it will be a long process to get all the experts to reconsider their assumptions, requiring battle-tested proof, and that probably won't happen in a single SO thread.
If you see a likely XY problem, answer X, then explain why they might want Y, and then answer Y.
But the answerers cannot know that. So adding a small snippet of what have been tried, or why X specific is what's needed is a good idea to steer the conversation in the correct direction.
I, for one, never use places like SO anymore because everyone just wants to pretend you really want Y, because that's an answer they know.
However, it's hard to tell if the quality has actually changed, or whether it's just more geared towards novice programmers and I'm just not asking the type of questions that get help on the platform anymore.
Although tbh I quite often want the opposite, so I add "Alternative solutions/workarounds welcome" or "I don't see how I can avoid doing X but maybe..."
Listing all of the things you don't want to do would not only take up more words and effort than the question about what you do want to do, but is hopeless. Somebody who doesn't know the answer to your question but still wants to comment will find something that you were unaware you didn't want to do.
It's better just to answer questions directly, and then when somebody uses that solution and it doesn't get them closer to the solution to their real problem, they'll ask a better question.
And bad solutions can still "solve" problems with horrible trade-offs, so instead of searching again for a better solution people may just employ the worse one unaware of the better possibilities, consequences be damned.
For instance, if it's a semi-vague question just pointing in the direction of a solution, then I think it's fair to question the motivation of the poster.
But if it's a very precise question about how to accomplish something specific, I think the burden should be on the person answering to add the clause: "you can do X, but its generally not considered a good idea because Y".
Honestly if you can't answer the original question, I get the impression you're just trying to be a smarty-pants and show off some domain knowledge you have which is related to the task at hand.
But people look for already asked questions by searching for them. And I don't think that there are many things that are more frustrating, then finding a questions that describes your problem X perfectly and it has only answers to Y.
Maybe the asker really would be best suited with X due to some contrived circumstance, but is that true of everyone else who finds the thread too? Probably not.
I.e. "you can do X to achieve your goal, but you probably shouldn't because Y".
I just don't see how it's helpful or contributive to participate in the discussion if you don't actually know the answer.