I was wondering if I felt someone had an XY problem (they have problem X but they go about it with Y and ask about Y rather than X), would it be appropriate to post an answer talking about a different way of going about a problem or would you comment first to clarify with the author of the question?

I've seen mixed experiences where someone was doing a problem one way, people suggested different solutions and they get downvoted because the author wanted it in that specific way.

I guess an example I had (kinda a while ago but it has come up and I want to make sure I'm going about it the right way) was this person was trying to find a way to direct users from one website via Javascript to other sites. I suggested in my answer that he should consider using header in PHP and some people commented that he specifically wanted Javascript while others said that it is appropriate to put these.

Thoughts on this? Wish I could find the question I answered. But I'm sure this has come up more than once. Thank you! Just trying to get more perspective.

  • Here are all your answers: stackoverflow.com/users/1168661/aug?tab=answers
    – Oded
    Commented Dec 2, 2012 at 19:58
  • Thank you Oded. I was looking through but I couldn't find it. I'm suspecting the question might have gotten deleted? I'll post it if I can find it. It wasn't a huge debate but I thought it was a question worth discussing.
    – aug
    Commented Dec 2, 2012 at 20:06
  • It may have been... these things happen and only 10k+ users will be able to see it if it was indeed deleted.
    – Oded
    Commented Dec 2, 2012 at 20:07

2 Answers 2


You could do either. There is no real fast rule here.

There is greater value to the community with the first approach - suggesting different ways and weighing the pros and cons.

Don't forget that when answering a question, you are trying to give a valuable answer to the whole community, not just the question OP.

  • Thanks for your answer. I kind of wanted to clarify the use of comments though because on one hand, I could comment and let the OP know that I think there is a better solution and then properly answer his question, or I could just answer it straight away. Thanks for your thoughts!
    – aug
    Commented Dec 2, 2012 at 20:09
  • 1
    @aug - That's my point. It really depends on the question and your mood at the time... Sometimes a clarification is appropriate (say if a large number of different options exist and clarification will narrow down the field), sometimes a great answer will include the best options and why.
    – Oded
    Commented Dec 2, 2012 at 20:10

As Oded pointed out - yes, it's good to provide other solutions. Often people haven't actually realised that they could fix their issue with a design-change.

However - if somebody is explicitly asking for a particular language, that generally forms part of the constraint of their question. Most people are generally stuck with using only those languages they are allowed to use on any given project.

Think of a language as a (generally) non-negotiable constraint. Recommending a language change, in that circumstance, is thus considered Not a Solution to the question, as-provided - which is a perfectly understandable reason for the answer to get down-voted.

You must log in to answer this question.

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