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?
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?
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`
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)
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).
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.
Good to know that there was no repealment for Cunningham’s law.
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.
...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.
> 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.
If "I'll need a research team and five years" is actually a valid answer to X (eg: X="How do I determine if a given jpeg image contains a bird?", at least... uh, five years ago), then it's a valid answer for the purposes of answering both X and Y. The problem is people giving incorrect/non-answers like "you shouldn't do that", and then pretending they answered the question because they also gave a (presumed for the sake of argument to be correct) answer to some different question, Y.
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.
Well sure, but do you actually disagree? IMO a lot of people are overthinking this and skipping the obvious explanation.
> The indisputable fact is that it is sometimes unhelpful and wrong.
Everyone, and every answering strategy, is "sometimes unhelpful and wrong". (So are AI helpers). So that's not a useful way to compare approaches.
Even if it's wrong, it'll still be helpful to see an attempt at answering both the question and your interpretation of a solution to the problem.
Only an incorrect and wrong attempt to answer an imagined problem (ie. Y) is actually useless.
> 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.