11

If a user asks a question along the lines of

I would like to do X with Y. How can I make Y do this?"

is it appropriate to answer with an alternative or more straightforward way to do X, even if it doesn't directly answer the "How can Y do this?" part?

I can't see how it falls into any of the criteria for deletion:

commentary on the question or other answers ✘
asking another, different question ✘
“thanks!” or “me too!” responses ✘
exact duplicates of other answers ✘
barely more than a link to an external site ✘
not even a partial answer to the actual question ?

I can see a bit of a grey area for the final one. Is it an exact answer? No. Does it partially answer the question? Yes. It's just another form of the XY problem, and if it can help the user asking the original question (or users finding the question later), I feel it's a useful addition to the site.

(Full disclosure, I had such an answer deleted, I'm sure I'll get over it but for future reference I'm interested in whether these answers are discouraged and if so, why?)

EDIT: I am happy with my answer being deleted and this is in no way a plea for it to be restored, I'm just looking for clarification for the future.

  • 10
    Thank you for taking the time to come here and post such a calm and civil question instead of ranting! That is always appreciated :) – terdon Aug 15 at 14:05
  • 5
    Ditto what terdon said! – Jeff Schaller Aug 15 at 14:16
16

No, if the OP is using the "wrong" approach, giving the "right" approach is absolutely fine. Also, if the OP happens to mention one tool and you answer with another tool, that's also fine.

However, that's not really what you did. You answered this question in which the OP had a list of target directories and wanted to limit grep to search in those directories only. Your answer was saying that if the OP had a list of things to exclude instead of to include, they could use grep --exclude-from-file.

This isn't the same question at all. If your answer had also included a way of converting a list-to-include into a list-to-exclude, then it would have been answering the question. As it was, however, you weren't simply suggesting a different tool, you were giving a solution to a different problem.

Since your answer, therefore, wasn't providing a solution to the question asked, a moderator deleted it.

11

I deleted your answer as not-an-answer because the question said, in part:

To save time and typing, I would like to store the names of the subdirectories to be searched in a file and use that when I run the find command next time

while your answer said:

While not an answer to the exact question, if you can reverse this to have a list of files not to search ...

Of course, the XY problem exists, but you've done something different: you've changed the assumption of the question altogether. I think you noticed that in the preface to your answer.

1

I'm no expert, but I believe that the answer is no, for the reasons cited here and elsewhere.

However -- what I would do is work with the OP to clarify the question. This falls squarely into the role of comments on the OP in order to improve the question. This way, if the OP does not concur, you've given it a good try in public. Unseen to you, this is likely to influence others who come to the same question -- if it isn't closed. And if it isn't closed, perhaps it was alright was it was.

I haven't seen the question alluded to here. Just answering for the general case.

0

Besides the actual case already discussed here, I'd like to drop two more thoughts on the general subject:

First thought

There is a difference between

I'm trying to do X with Y.

and

I would like to do X and want/need to use Y for some reason.

In the first case, the OP is likely to be happy when learning that this is easier to be done with approach Z.

In the second case, especially with a reasonable argument for choosing approach Y, the Z answer won't be of any use to him. This often happens if a complex task is reduced to an example, which could be done the Z way, but the whole problem requires Y. It's up to the OP to make that clear, but unfortunally some people don't seem to read such a disclaimer.

Anyhow, giving a useless answer doesn't cause much harm. Worse is closing such a question as duplicate of a question answered with Z.

Your example wording

I would like to do X with Y. How can I make Y do this?

is could be first or second case, but more like the first one, because no reason for choosing Y seems to be given.

Second thought

Even if the OP clearly states, that the Y approach is required for some reason, it may be useful to give a Z answer, because this is a Q&A site. People without the Y restriction will find the page via some web search and follow the Y path for no reason, if no Z answer was given.

If a comment on the question is not sufficient, I usually start such answers with a phrase like

If you are not restricted to using Y, you should better ...

The OP can stop reading at this point, but future readers may find this useful.

-2

I have a strong response of "No." In fact, the situation you describe is one of the things I hate most about using this site.

I have a rigorous method for solving problems. When I ask a question in pursuit of a solution, I put work into making sure that question is well-defined and precisely the question that I want an answer to. When someone responds by questioning my premises or trying to answer the question they assume I mean to ask instead of what I am asking, it's maddening. It's noise, and it makes it harder for me to find the information I'm looking for.

I don't mind being asked to clarify something or provide more information, but as a rule, I would rather users refrain from responding at all if they can't provide information that addresses my question as asked.

  • I can see three questions from you on this site (Unix & Linux). If any of them produced answers that miss the target in the way that you describe, you should leave a comment to that effect to the user answering. As far as I can see, you have not commented on any of the answers that you have received, nor accepted any of them. – Kusalananda Aug 27 at 21:34
  • I feel your pain, but mind that for each user like you who puts lots of effort into solving their problem and formulating the question, there are ten novice users who just guess what the solution could be because they don't know any better. Answering their questions as asked will be like telling "you are on a balloon" to a balloon traveller asking where they are. Clearly there's less overall damage if someone helps such users, and then maddens you with an answer you don't like. – Dmitry Grigoryev Aug 28 at 7:04
  • @DmitryGrigoryev I don't mean that the question must be answered literally. Telling your ballooner "You're in a balloon 5,000ft over Glasgow, Scotland" is both useful and answering the question as asked. What I'm referring to are the barrage of responses like "Why didn't you just take an airplane? That would be faster" that don't address the question you asked at all, only what the responder wants to imagine you asked. – PiotrChernin Aug 28 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .