6

If it is more or less clear that somebody asks a question for a problem, but there is a better alternative, can that alternative be given as answer or only as comment?

Example: somebody asks if it possible to enable a disabled control by double clicking on it and someone thinks it is better to not use this method but add a checkbox to enable the control, is this only a comment or a legitimate answer?

2

5 Answers 5

18

Absolutely give it as an answer!

All-too-often the question is:

How do I do X?

When really it should be phrased as:

I have a problem Y. I believe that if I can do X it will solve my problem. How do I do that?

If you have a solution for the problem by all means share. It's possible that the asker has tried that and it didn't work out, but more likely they just didn't think of it.

7
  • Thanks, I asked it because I got a downvote (without comment but it was in this category). Feb 21, 2012 at 14:19
  • 3
    @MichelKeijzers - I'd be careful how you word the answer - the best answers often address the direct question briefly and then explain why it's better to avoid that situation altogether by doing something related. If you just go on a tangent or look like a rant people won't appreciate it even if you're technically correct.
    – Flexo
    Feb 21, 2012 at 14:28
  • @awoodland Of course I will try to be careful at my wording. Feb 21, 2012 at 14:33
  • 1
    @MichelKeijzers I assume this is the answer you are referring to?. Agree I think it would be better if it addressed the actual question asked more. Feb 21, 2012 at 14:37
  • 1
    @Martin Smith Ok guess I should have add more towards the question and then come up with an alternative. Feb 21, 2012 at 14:39
  • Completely agree. Sometimes the best thing you can do is let someone know that they're solving the problem the wrong way, or solving the wrong problem altogether.
    – Tim Post
    Feb 21, 2012 at 14:54
  • 1
    Specifically the OP was violating the Principle of least astonishment Feb 21, 2012 at 15:09
8

Yes, absolutely! Sometimes the best answer to a question is "Don't do that, do this instead". If the OP has a reason to do things in an unusual way, he should mention that in his question. In ambiguous cases, I usually try to answer the original question, but also mention the alternate solution in my answer.

7

I found a really good blog post that relates to this type of question. I often will say

This is a "Old Shoe or Bottle" Question...

And then proceed to explain the alternative method.

Here is a basic summery of the blog post so people don't need to click through

Pounding A Nail: Old Shoe or Glass Bottle?

"A client has asked me to build and install a custom shelving system. I'm at the point where I need to nail it, but I'm not sure what to use to pound the nails in. Should I use an old shoe or a glass bottle?"

How would you answer the question?

  1. It depends. If you are looking to pound a small (20lb) nail in something like drywall, you'll find it much easier to use the bottle, especially if the shoe is dirty. However, if you are trying to drive a heavy nail into some wood, go with the shoe: the bottle with shatter in your hand.

  2. There is something fundamentally wrong with the way you are building; you need to use real tools. Yes, it may involve a trip to the toolbox (or even to the hardware store), but doing it the right way is going to save a lot of time, money, and aggravation through the lifecycle of your product. You need to stop building things for money until you understand the basics of construction.

I would hope that just about any sane person would choose something close to (2). Sure, it may seem a bit harsh, but think about it from the customer prospective: how would you feel if your carpenter asked such a question?

I find it a bit disturbing, however, that this attitude is not prevalent in software development. In fact, from what I can tell, it seems to be discouraged.

3

Only a comment. But if you write up how to do the asked, or give a reasoned argument against the asked-about way, it is fine to strongly recommend your alternative approach.

Q: How do I frobble the wobble?

Then

Better fribble the wibble.

is a comment, but

You can't, because frobbling only works with nobbles, but you can fribble the wibble to achieve your goal.

or

You do it thusly, but really, fribbling the wibble is better.

or

It's a bad idea to frobble the wobble because that would bobble the hobble, therefore it is better to pursue your goal by fribbling the wibble.

are suitable answers.

4
  • 1
    Commenting asking for clarification might be appropriate, but unless it's explicitly stated then the alternative, superior solution to the bigger issue seems like a useful answer without any debating.
    – Flexo
    Feb 21, 2012 at 14:29
  • I think it depends on the asker. If he seems like he knows what he's doing, a comment might be more appropriate, but if it looks like a beginner who's just confused, I usually jump straight to giving the "don't do that" answer.
    – hammar
    Feb 21, 2012 at 14:33
  • 1
    @hammar - my experience is that the non-beginners almost always identify the more obvious solution they've discarded in the question up front
    – Flexo
    Feb 21, 2012 at 14:35
  • @awoodland: Yes, usually. But sometimes people forget, and then I'd rather post a comment that sparks an edit to the question than post an answer that will soon become irrelevant. It's usually not too hard to judge, though.
    – hammar
    Feb 21, 2012 at 14:43
2

It depends on the person. I just got reprimanded for "not really answering the question" - the person asked:

How can I do [x] without using [y]?

I commented:

Why do you not want to use [y]?

They replied in a comment:

Because of untrue assumption [A].

So I answered:

you can use [y] (and here's how) because [A] is not true.

They up-voted my answer, but stated they didn't like it because I didn't answer the question (even though the question was faulty), and accepted the less efficient method that still unnecessarily avoided [y].

3
  • Yes this is indeed the reason for my question ... I gave also an alternative (y) in your case ... the question was not incorrect, but it was a strange way of getting something done (at least in my opinion). Feb 21, 2012 at 15:27
  • 1
    Sometimes people be crazy.
    – user154510
    Feb 21, 2012 at 16:03
  • Yes, sometimes they be. Here is what I am talking about: stackoverflow.com/questions/9377775/…
    – Aaron Bertrand Staff
    Feb 21, 2012 at 16:14

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