6 of 7 deleted 84 characters in body; edited title

Why should a developer ask “why” when someone asks them how to implement a solution?

When someone asks me how to do something, and I know the answer, but what I usually do is ask them why. From their perspective, it's like:

You go to someone who you know has the answer to a question, ask that person the question and they answer with the typical response: "why?" You explain why you need to know, and they attempt to solve your problem, instead of directly answering the question.

How can we explain to these askers that we need to know why they think their solution is right for their problem?