3

Possible Duplicate:
Is “Don't do it” a valid answer?

If the underlying implementation within a question may deserve redesign (depending on OP's intent), should the answer address the question as it is stated, or assume the redesigned is warranted and answer the question under the redesigned principle?

A question is asked specifically about a given topic. The design used in the question is arguably not the best design for 70%-80% of uses, but is sometimes perfectly legitimate. And the design is directly related to the topic of the question.

It boils down to: Which one of these responses is most appropriate (and which are inappropriate)

  1. Answer the question as is
  2. Comment on the question with recommended design, then answer question as is
  3. Answer the question with recommended design
  4. Comment on the question with recommended design, then answer the question with recommended design
  5. Other?

The specific situation I found myself is here - but I assume this incident isn't isolated.

7
  • What you you mean when you say "redesigned" and "design"?
    – Bart
    Aug 24, 2012 at 17:59
  • Designed/Redesigned = means using different Classes/Functions/Approaches. Essentially if an example is given, it would be replacing the core of the question (70%+ with different code). Mind you that code could be legit.
    – Nick Rippe
    Aug 24, 2012 at 18:21
  • 1
    Ah, we're talking code/coding here. I assumed you simply meant "rephrased".
    – Bart
    Aug 24, 2012 at 18:22
  • Updated question to clarify. Thanks!
    – Nick Rippe
    Aug 24, 2012 at 18:43
  • @ValetTree I'm not asking if it's okay to answer "Don't do it" (and the chain). Personally I want to know the opposite - Is it legit to just answer the **** question (not spend time extrapolating on what the OP may be doing), or should I always put a note on it saying "But 70%-80% of the time, you really want to do this".
    – Nick Rippe
    Aug 24, 2012 at 19:25
  • strong opinion (as you know and experience from my down-votes :-) here: definitely no most of the time. Good questions must try to find out what the underlying problem is (instead of answering on face-value)
    – kleopatra
    Aug 24, 2012 at 21:34
  • @kleopatra I really don't have a very strong opinion (hence why I asked the question). I want to know the best way to help. In my instance, the underlying problem was corrected by my answer - it was a separate design problem that I was told I should have addressed in my answer. Thank you for your input (As always)! And don't start just because I mentioned it - but I don't think you've ever downvoted me (Just warned me once, which was educational). :-)
    – Nick Rippe
    Aug 24, 2012 at 21:51

2 Answers 2

5

I answer the question that is asked, but point out that there is a better way to do it, explain why, and give an example. Like this:


Use the UPDATE statement:

UPDATE STUDENTS SET NAME = '" + Name + "'";

However, you shouldn't do it this way, as it leaves you vulnerable to SQL Injection. Consider using parameters instead, like so:

UPDATE STUDENTS SET NAME = @Name;
3
  • depends big style on the - concededly assumed - expertise of the questioneer. There are obvious no-goes and typical newbie errorrs/misconceptions which require to simply not answer the face-value question: it's the-wrong-thing-to-do in 99.999% of contexts - whoever really has the 0.whatever off context context will be able to point that out
    – kleopatra
    Aug 24, 2012 at 21:29
  • 1
    I don't think there's anything wrong with answering the face question, as long as you also show the right way to do it. If a person has less expertise, even more reason to explain the wrong way and the right way, and contrast the differences. We're not these people's parents; if they touch the hot stove even when we tell them not to, it's on them, not us.
    – user102937
    Aug 24, 2012 at 21:32
  • obviously no parents ;-) My preference is to do it the other way round: simply make a strong point in why the original question is probably asked for the wrong reasons ...
    – kleopatra
    Aug 24, 2012 at 21:38
5

The problem as I see it is that often a coder who is having difficulty solving a problem will ask a specific question on SO regarding a code solution that they are trying to use to solve the problem, when the real issue is that they're barking up the wrong tree, that there avenue of approach is wrong to some degree or another.

In my admittedly biased opinion (and that's all that this question can be about), the best solution is to get as much information about the problem domain from the original poster, and then based on that (or failing that, try to make the best assumptions about the problem domain ) post the best solution for the problem domain rather than automatically solve the direct question. If a solution is offered that just solves the concrete question, there should in the very least be some discussion on whether there may be better approaches to solving the problem at hand.

Edit: You State:

The problem domain can still be unclear.

I agree 100% and that is why part of our responsibility is to try to clarify it as much as possible before answering, or given continued ambiguity, answer as best we can with caveats.

Also, if we only answer according to the OP's interpreted intentions, doesn't that imply that the only benefactor of the question is the original poster? By the time someone else sees the post, the context of the question could have changed (OP's reputation in our case).

I think that just the opposite is true. If we answer the OP's specific question, we are just doing that, solving a specific code issue while possibly ignoring the greater problem -- that of what is the best way to get keyboard input in this situation. By answering the overall problem, we increase the odds of helping more folks with similar problems in the future. We don't want to be too narrow in our answers as to not see the forest for the trees.

7
  • Agreed that a discussion is warranted. But is posting an answer one way or the other wrong (as I felt was implied)? Also, the "problem domain" is a loaded term - isn't that what this whole question is about? What is the problem domain - the original question, or the recommended redesign?
    – Nick Rippe
    Aug 24, 2012 at 18:25
  • 1
    The problem domain is neither. It is the overall problem that instigated the question in the first place, the question about how to get the desired behavior, not the specific code pathway to achieve it. The debate comes down to what are the bounds of this domain. Aug 24, 2012 at 18:27
  • The problem domain can still be unclear. Also, if we only answer according to the OP's interpreted intentions, doesn't that imply that the only benefactor of the question is the original poster? By the time someone else sees the post, the context of the question could have changed (OP's reputation in our case).
    – Nick Rippe
    Aug 24, 2012 at 18:35
  • @Nick: please see edit. Aug 24, 2012 at 18:46
  • The problem I have is when you say "the best way to get keyboard input in this situation", you're assuming we know what "this situation" is (problem domain is unclear, and the OP isn't clarifying). So rather than assuming the OP doesn't know what he/she is doing, I'm assuming they do. And it seems you think I'm wrong for doing that.
    – Nick Rippe
    Aug 24, 2012 at 19:30
  • 1
    +1 to typical context of questions like "I need to do xy and have problem yz - how do I solve yz?" is the I need to do part of the question. They have a problem, try to use it with yz and yz poses another problem which they ask about. Most of the time the real problem is that yz isn't a solution so they are asking about a problem introduced by an assumed solution. So the task of a helper is to find out the task before xy, not the secondary introduced by the assumed one.
    – kleopatra
    Aug 24, 2012 at 21:21
  • @kleopatra I agree 100% with your comment. Where I have issue is when someone asks "I have a problem - I can't get xyz working" and 80% of problems using abc is the best option to use (other 20% xyz is best). xyz is still legit, so what do you do?
    – Nick Rippe
    Aug 25, 2012 at 2:13

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