4 ms·
I think a good answer to a question that you think is an XY problem, should answer both X and Y. When there is an XY problem, Y might be the better option, but
by camel-cdr 3y ago
I think a good answer to a question that you think is an XY problem, should answer both X and Y.
When there is an XY problem, Y might be the better option, but most of the time understanding the solution for X is still very interesting.
Also, if somebody can answer Y, but not X, are they really qualified enough to answer the question?
- kevincox 3y agoThe problem is more often that I can answer X, but it is very long, convoluted and odd. Because the question is based on bad premises. If you ask Y it saves us both a lot of time because I can give you a good answer without going down path X in the first place.
- koala_man 3y agoMy favorite example that I see pretty often is "In posix grep, what's a regex that matches lines that don't contain the word `test`?" The X answer is a lecture on language theory including the construction and inversion of finite state automata. Absolutely interesting, but a long and dense chapter in a CS textbook with no practical applications. The Y answer is `grep -v test`
- falserum 3y ago> The X answer is a lecture on language theory including the construction and inversion of finite state automata. To be helpful and educational, one must describe/illustrate the failure mode of X. For example just demonstrate how unwieldy pure regex is for more constrained question like “regex to check if there is no ‘ab’ within 3 char string”. “a[^ab].|.a[^b]|[^a][^a].”. (Solution complexity grows with length of the string within which we are searching)
- a1369209993 3y ago> (Solution complexity grows with length of the string within which we are searching) No it doesn't. It's something like '([^a]|a[^b]|a$)*'. In general it scales like '([^a]|a([^b]|$)|ab([^c]|$)|abc([^d]|$)|...)*' (ie, quadratically with the length of the needle, if I haven't overlooked a optimization), but the complement of a regular language is regular, and fixed strings are always regular, so it's always a pure regular expression (including being independent of haystack length).
- falserum 3y agoThanks. Good to know that there was no repealment for Cunningham’s law.
- a1369209993 3y ago> It's something like '([^a]|a[^b]|a$)*'. And, proving that any curt correction of a silly error will likely contain its own silly error, I think that should actually be '^([^a]|a[^b]|a$)*$', since grep defaults to searching rather than matching.
- kuratkull 3y agoIt seems to me that your Y is actually the X. An actual Y would be to suggest they use Perl instead.
- Xcelerate 3y agoAnd how do I enable Perl regex for e.g., the Snowflake SQL regex functions? ;) I’m laughing because I had this exact XY problem. Searched StackExchange for a potential workaround for a certain regex I wanted to match, and the answer said to use Perl regexes instead. Cool... except as far as I can’t tell the database we use doesn’t support that. I rolled my eyes and went to look at other search results.
- gwd 3y agoThe X asked for a regex, not a command-line parameter. It's possible that the user was actually using POSIX grep, in which case Y ("don't invert the regex, use this command-line parameter to invert what's done with the result of the regex") is the answer they actually need. It's also possible that they're using some other tool, which they know implements POSIX-compatible regexes, but doesn't have an easy way to invert the usage; in which case the user really does need an answer to X (i.e., a way to invert the regex).
- wokwokwok 3y agoYou think, in your opinion, that Y is both what the asker wants and needs; but this is empirically and objectively false in some cases, unless you are infallible (unlikely). ...and here-in lies the problem. It's the hubris that "I am right" that leads people to answer Y instead of X. Y and X are maybe related, but ultimately, X is empirically what was asked. It's your take that Y is the solution that the asker wants instead of X. Maybe you are right, sometimes. It's very unlikely you are always right. Therefore, it's likely, that sometimes when you do this, you're actually not helping; the answer is X, and your comments about Y are both wrong and unhelpful. Come on, are you never wrong? We're all wrong sometimes. At the very least, you can often start answering X (a long partial answer) along with 'and this is why Y is maybe a better solution...' I suggest that the 'race to be the first answer and get karma for it' is the motivator that drives people to do this on some platforms, rather than any actual desire to help / any actual competence in the question domain / actually knowing what they're talking about in many cases; a partial answer to X is never that time consuming. ...it's just more time consuming than not answering it at all.
- lmm 3y ago> Therefore, it's likely, that sometimes when you do this, you're actually not helping; the answer is X, and your comments about Y are both wrong and unhelpful. > Come on, are you never wrong? We're all wrong sometimes. Whatever you do you'll always be wrong sometimes. Answering Y is usually helpful, that's why people do it. > I suggest that the 'race to be the first answer and get karma for it' is the motivator that drives people to do this on some platforms, rather than any actual desire to help / any actual competence in the question domain / actually knowing what they're talking about in many cases; This is, if anything, even more true of people who answer the literal question asked while giving no thought as to what the questioner actually wants. > a partial answer to X is never that time consuming. Disagree. Often X really is something possible-but-difficult; you can give a "partial answer" in the sense of "I'll need a research team and five years", but that doesn't really help anyone.
- wokwokwok 3y ago> Answering Y is usually helpful, that's why people do it. That's just opinion. :) The indisputable fact is that it is sometimes unhelpful and wrong. Is it more harmful to be partially wrong in answering/trying to answer a difficult question, or wrong about helping at all? Still, on the bright side with the rise of AI helpers, most people don't need anyone to answer trivial questions going forwards, and actually, it becomes (opinion, mine) increasingly clear that answering hard questions is significantly more valuable in a post-AI world. /shrug I think, most of the time, answering hard questions is actually not as hard as people imagine them to be. The answer is usually either 'that's not possible because of blah' (eg. platform restriction) or 'doing it that way is hard because of blah, but if you wanted to, you would look up these things to do it'. ...but often people are too lazy to add that to their answers. 5 years is total utter hyperbole. Obviously. Spend 10 minutes trying to answer X before you say 'do Y'. 10 minutes. It's such a tiny investment of time, you're just being lazy if you don't.
- plagiarist 3y agoIt is truly classy when people do both. Very respectful of the questioner while still conveying that there might be a better approach. You're right, in almost every case it is interesting to read each approach.
- thayne 3y agoAnother valid response if you think it is an XY problem is to ask for more information. Or even do all three: "Here's how you do X. But if you really need Y, then you should do Z instead. What are you actually trying to do here?" > Also, if somebody can answer Y, but not X, are they really qualified enough to answer the question? Maybe. It could be that there just isn't an answer to X. Or the answer is "you can't", so the author tries to give an answer that is more helpful, in case the asker actually wants Y (it would probably be good to explicitly explain that though). Or maybe there are multiple ways of interpreting X, and the answer interpreted it a different way than you expected.