148

If someone asks how to do XYZ, and you think doing XYZ at all is a Bad Idea™, is it valid to post an answer saying so? You aren't answering the question, but instead, arguing the question's validity. You could do this in a comment, but I don't think comments carry enough weight on occasion.

For example, I came across this today SO1176239; for those not wanting to link away:

I would like to build a wiki based website about professors, so that students can share information and check the reputation of the professor before working for him.

and I really wanted to post an answer that said, "I think this is a very bad idea". (In fact I did anyway, despite awareness that it could get myself flamed.)

Was I wrong? What should I have done instead?

  • 166
    Why didn't you tell them to use jQuery instead? – random Jul 24 '09 at 8:39
  • 22
    You'll have to build the website around the professor at nighttime, so that when he wakes up he won't know where he is – Tom Aug 11 '10 at 11:41
  • 10
    The SO post labeled SO1176239 here doesn't exist. – Daniel Serodio Jan 26 '11 at 16:46
  • 4
    Very related, a question where "Don't do it" is clearly the right answer, but the answer still gives the method How to disable kill command on Linux – Davy M went to fund Monica Dec 26 '17 at 17:15
  • @DavyM The answer that links to doesn't say not to do it, just to expect very bad things to happen. – zugzwang Jan 13 '18 at 5:23
  • @zugzwang The second answer starts with "You should not disable it system-wide because..." with an explanation, which is a great "Don't do it" answer, and is a completely valid answer. The first answer (The one I linked directly to) gives the person exactly what they asked for -- a tool to completely mess up their machine. The point is, both are valid answers, including the "Don't do it" answer. – Davy M went to fund Monica Jan 13 '18 at 18:34
  • @DavyM For me, that links to the question starting with "Use this kernel module to disable the kill system call on amd64. Use at your own risk. Devastating side effects are expected." and the id (1092160) in the link matches that found on the upvote flag of my quoted answer. Incidentally, the answer to which I refer (and your link seems to point) has ~8 times the upvotes (57 vs 7), and is accepted as correct or best answer, not the one you quote. – zugzwang Jan 13 '18 at 21:26
  • My bad, it wasn't accepted, but does have higher vote count. – zugzwang Jan 13 '18 at 21:31
  • And the accepted answer also does not say "don't do it", but instead also makes clear "don't do it" should probably be the conclusion a sane person would make in most if not all situations, while actually answering the question directly. – zugzwang Jan 13 '18 at 21:53
  • This is a lesson for everyone: Don't include a link to a question in your Meta question, it will be deleted. – user474678 Jun 24 at 17:59

12 Answers 12

167

I think it's a valid answer, provided that you explain why the OP shouldn't do it (which you did in the question you gave as an example). But I would consider also to answer the actual question, too. As in "Don't do it because of A, B and C. But if you decide to do it anyway, I would follow this approach:..."

I have recieved one or two Don't do it answers on my questions, and I find it very helpful to question my own decisions on how to approach a problem. (It also bruises my ego a tiny bit, but that is outweighted by the benefits).

  • 50
    agree, it is OK as long as you explain why in a well reasoned way with at least one web citation to back up your position – Jeff Atwood Jul 24 '09 at 9:27
  • 3
    I answered with a don't do it to a question about using regex to validate the number of spaces in a name. I assume no one minded as it was the accepted answer. – pipTheGeek Jul 24 '09 at 15:51
  • 25
    A don't do it answer without explaining your reasons is pointless as the OP will probably go ahead and try it anyway – Casebash Oct 29 '09 at 5:27
  • 6
    Vote up, when theres an answer saying don't do it because of this reason and this is how to better do it is very helpful. Sometimes though people just say don't do it and thats it, very unhelpful. – Rudiger Jan 24 '11 at 22:41
  • 14
    "at least one web citation to back up your position"??!! Bah, the whole point of rep is that you are the authority. – CurtainDog Feb 23 '11 at 14:08
  • You write you would "consider an actual answer" but I'd say that's by far the most important thing, and that every effort should be taken to include the actual answer! There are plenty of misguided "Don't do that" answers on SO ("Never create an NSView in code!!!" comes to mind). Answering the actual question is not only easiest way to prove your admonition is not just knee-jerk cluelessness, but also to show respect to, and to educate the SO community. – Charlesism Oct 23 '15 at 1:04
  • 1
    I'd just like to pitch in, that a "go the extra mile" solution would be to say "Don't do it, because <insert reason>." but also follow up with "This is how I would solve your original issues/problem/request". Simply steering the OP in the right direction by teaching them a way of thinking around the problem can go a long way. – Torxed Jan 13 '18 at 1:02
41

"Don't do it" is not a useful answer to a question of "How do I do XYZ?", unless it is embedded into a section of your response.

I usually break down my "don't do that" responses like this:

  • To answer the question
  • Why you should not do it that way

In the past, I was working a personal project just to explore some ideas/concepts. I asked "How do I do X in Y situation?" and received dozens of "Don't Do It!!!!" responses, which then got upvoted (downvoted by me), only one poster actually answered my question.

In my case, I specifically stated that I knew it wasn't best practices, I was just trying to explore. Therefore, the flurry of "Don't Do It!" responses were incredibly unhelpful.

So, because this is a technical Q & A site, you should answer the questions as best you can, to tell the OP "Here's how you do that" or "Here's how you would accomplish that task" maybe with a different approach. THEN, only after you've answered the actual question, should you explain why it is not a good idea. Otherwise, you're just scolding people.

EDIT

In response to RSolbergs comment: "It's acceptable if you are answering "Is it okay to do this?""

If someone is asking "is it okay to do this" then yes, you can say "no" as long as you are backing your answer up. That is not the situation I was referring to. In that situation, it doesn't make sense to have a policy that forbids 50% of the answers.

I'm talking about the situation where someone asks "How do I do XYZ?", if you say "Don't do XYZ" you are literally NOT ANSWERING THE QUESTION!

An analogy. If someone yells at you, "Hey, how do I get out if I'm trapped in a well?" and you yell back "Don't Fall In!"

You can then chuckle at how clever you are, and walk away while that person drowns.

EDIT

In response to Shog9 mention of things which should just not be done.

See "Questions with Nefarious Intent".

Stack Overflow is a technical Q & A site. It is not supposed to be the place for the high and mighty to make judgments on the others. If you feel uncomfortable with the question being asked, then you should not answer it.

I had a discussion with a colleague about whether or not it is possible to create a web page which could access the printer directly and print something. He said it was not, I insisted that it was possible. In a million years, neither of us would ever use this on a production app, it would be DISASTROUS. But, the technical question was intruiging to me, so I put it forth to Stack Overflow. I mentioned that I would obviously never do this, and I still recieved "Don't Do It!" responses. Which were, as I've mentioned over and over, completely useless.

For questions that are concerned with limits of technology, and the possibility of creating some functionality when under severe restraints, I would go to Stack Overflow, because the people there are millions of times smarter than I am. However, once I've laid out the technical question, I am looking for a technical answer, not for someone to preach to me.

I don't mind if someone says "This is a bad idea, I would do this instead, but here is an answer to your question" That is fine, because they have still provided an answer. However, if all they can say is "Don't do that" then I'm exactly where I started.

Technical questions deserve technical answers, and Don't do it does not answer the technical question.

  • This answer is completely useful to someone who asks "is it OK to do this....." – RSolberg Jul 24 '09 at 15:16
  • 5
    On the one hand, i can sympathize: i asked a question looking for legitimate uses for a much-maligned language feature, and was quickly slammed with replies urging against its use in any situation. Not very helpful... On the other hand, i've seen questions asking for help doing things that are unkind or flat-out dangerous to others. I don't want to answer these questions and then warn against using the technique presented in my answer - that's handing a toddler a loaded gun and then asking him not to shoot anything! I'd rather convince him of the danger and help him avoid the entire situation. – Shog9 Jul 24 '09 at 17:26
  • 8
    I think a better analogy would be if someone asks, "How do I get out of a well after I jump in?" – mmyers Jul 24 '09 at 17:31
  • 3
    @mmeyers, then on SO, you'd get the response of "Just don't jump in in the first place" – devinb Jul 24 '09 at 17:36
  • Technical questions deserve technical answers; hypothetical flights of fancy with no real world application are not technical questions. – CurtainDog Feb 23 '11 at 14:12
  • Absolutely, and additionally `don't do it' answers might be next-to-useless for people arriving at the question via search. – James May 23 '11 at 16:07
  • @CurtainDog Just because something doesn't have real world application doesn't mean it's not technical. On the other hand, it could be stupid... – Milind R Feb 5 '14 at 16:34
38

It seems to me that there's gradations to this.

There's cases where the poster is trying to do something he or she really shouldn't, whether illegal or immoral or thoroughly unwise. I tend to mention this in an answer, along with any helpful technical information.

There's cases where the poster is trying to do something impossible, and in that case I usually explain why it's impossible, and often make a guess as to what the poster is trying to accomplish so I can offer suggestions.

There's cases where the poster is asking how to use a tool in a screwy manner (wanting reserved checkouts on SVN, for example), and in that case I explain why this is a bad idea and (if possible) how to do it.

An answer that's just "Don't do that!" is useless, unless the poster is asking whether it's OK, in which case it's just mostly useless. It should always be accompanied by reasons. An answer that doesn't respect the poster is also pretty much useless (just downvote the question and have done if you feel that way). However, an answer that tells the poster how to do something stupid, just to strictly answer the poster's question, is worse than useless.

20

It depends on the context.

A considered response to a question that is asking for help to something that could be hazardous or illegal (and the latter is a minefield because of the global nature of the forum) would seem helpful to me. A comment should suffice in many cases but an answer may be appropriate on occasions to make the point more clearly or to layout supporting materials and references. More rarely, flagging the post may be appropriate if it is clearly a very bad thing that is proposed.

On the other hand an answer of 'You'd be better off buying a MAC' to a question that asks how to do something on MS Vista would seem wholly inappropriate (I don't use either of those platforms so can remain neutral on such technical matters).

  • 5
    Neither Mac nor Windows? I wonder what other alternative is there... BeOS? ;-) – Treb Jul 24 '09 at 8:28
  • 2
    NeXT Workstation? An abbacus? BSD4.4? – perbert Jul 24 '09 at 13:04
  • Ooh...NeXT...bet those are getting pretty tough to find by now. – beska Jul 24 '09 at 17:24
  • @beska: Just use a Mac. The Cocoa framework is basically derived from the NeXT. – David Thornley Apr 5 '10 at 20:02
  • @David Thornley: I know. I used to work at the OmniGroup aka Omni Development...a company that developed exclusively for NeXT (and now develops for Cocoa). Remarkable how far ahead of the curve NeXTSTEP was in a lot of ways. – beska Apr 6 '10 at 12:53
  • 2
    And OS/2. Don't you dare forget OS/2. – ЯegDwight Aug 26 '10 at 12:19
12

Generally speaking, if someone asks how to do something and you think it's a bad idea, give them some kind of answer to what they want and then explain why you think it's a bad idea (or just what the downsides are) and how they might do it better.

One should avoid preaching one's views. Your answer and your tone should reflect thoughtfulness and consideration.

  • 2
    Sometimes it's not a view, nor preaching. 1/0 will cause a problem, usually a divide by zero fault or exception. That's just a fact. – John Saunders Jul 24 '09 at 11:09
  • 2
    @John: But in that case you're not saying "Don't Do It" you're saying "It won't work." There's a difference, because people usually only say "Don't Do It" on things that would actually work, but don't fit into certain paradigms. – devinb Jul 24 '09 at 12:20
  • 7
    If I ask you "how do I break into your house and what vulnerabilities in your security system can I exploit", do you "give me some kind of answer" first, or do you just say "Don't do it"? – Paul Tomblin Oct 31 '09 at 15:33
  • 3
    1/0 isn't too bad in IEEE floating point math; it's just positive infinity. 0/0 OTOH, that's plain bad news. – Donal Fellows Jun 26 '10 at 16:45
8

Personally, my most common experience with this is dynamic SQL vs query parameters. If you see someone using dynamic SQL in their question, it's definitely appropriate to assume they don't have a good reason until they tell you otherwise. You may have a different experience, but I at least am not going to let an obvious security issue go unchallenged.

Now, I recognize that not all instances of this issue rise to the level of security problems. For less severe problems it might be better to just let it slide. But even here, I feel that even if the OP knows what they're doing, someone else who reads the question later might not, and it's important to have a well-voted post with the question mentioning that something may not be appropriate most of the time.

  • Until I got to the final it's important to have a well-voted post with the question I figured a comment would be good enough. But indeed, an answer stands out much better than a comment. – Arjan Apr 5 '10 at 17:13
  • @Arjan - a well-voted comment is often good enough, and occasionally I'll do that. But more often it really is a dynamic sql problem and I not only want to suggest query parameters, but show an example as well. And comments just are not conducive to that code example. – Joel Coehoorn Apr 5 '10 at 17:27
  • 2
    I'm not sure whether to up or downvote this. I agree that the top-voted answer should mention that it is a bad idea, but I adamantly do not believe that the top "answer" should not be an answer at all. As I mentioned at length in my (much maligned) response, "don't do it" is not an answer to a technical problem, mostly because even if they agree with you, they STILL have a problem, and now they have even less idea how to deal with it. That is the opposite of helpful. This means that the best answer would be of the format:... – devinb Jul 6 '10 at 19:10
  • 2
    "You shouldn't do X because of Y. Z will accomplish the same purpose without the disadvantages of A,B,C". If you do not provide a VALID EQUIVALENT alternative, then it simply isn't an answer. The added note is that when I say "VALID EQUIVALENT" is that it does not involve other technologies/frameworks/products. If it involves changing frameworks or downloading something, then it's a useless response, because you have to assume that the user is in an environment where they can do that. – devinb Jul 6 '10 at 19:11
  • Well-voted != top-voted – Joel Coehoorn May 13 '11 at 5:28
6

I think that in general it is not okay1, here's why:

People searching for the same problem in future will find the question -- but it won't have any useful answers. They might have subtly different circumstances that make the "don't do it" answers incorrect, but if they try to open a new question then it would likely be closed as a duplicate.

Would the Right thing to do in those circumstances be to edit the original question to make it more general, and add a bounty?

If people have to describe the minutiae of circumstance justifying their questions then it could easily make them much longer, harder to read, and less general.

1At least, not without also providing the desired answer

  • 2
    No, the right thing to do in that circumstance would be to ask a new question, linking to the original but explaining that your particular circumstances are different and that the answers to that question do not work for you. That's perfectly acceptable. – Cody Gray Jul 28 '13 at 10:13
  • "If people have to describe the minutiae of circumstance justifying their questions then it could easily make them much longer, harder to read, and less general." This is really true. I think there needs to be a presumption that the full story and motivation extends beyond what the OP wrote in the question. – Owen Jul 29 '13 at 1:34
3

You can net over 2600 votes that way. The <center> cannot hold it is too late.

2

YES. If it answers the question. May also give a suggestion on what to do!

Some may say "Dont do it" to this post, oh well.

  • I've edited my response to incorporate your feedback. – devinb Jul 24 '09 at 17:08
0

As my previous, deleted answer to the current question clearly illustrates, "Don't do it, it's a bad idea." by itself certainly isn't a valid answer, and will be deleted immediately. This would indicate that the current community consensus is NO, its not a valid answer.

A complete and/or well-crafted answer will make clear whether or not something is a bad idea. Adding "don't do it" to such an answer would not only be superfluous, but also condescending as it assumes the question asker could not make up his own mind even when spoon fed all the relevant information.

Even with support, as How to disable kill command on Linux illustrates, the community appears to concur with the opinion that it just isn't a good answer. An answer to that question is cited as supporting the validity of "don't do it" as an answer, yet neither the accepted answer nor the highest voted answer to the question actually say "don't do it". They have also been voted up (collectively) 15 times for each vote an on the answer which actually does. Furthermore, it is an incomplete answer, as it does not directly answer the question at all.

"Don't do it, it's a bad idea" is not a valid answer. It is, at best, a superfluous component of a possibly otherwise good answer.

-4

Late answer, but pure logic tells, that given question pairs only with given TYPE of answer:

  • would you...? --> yes/no
  • is it...? --> yes/no
  • how/why...? --> explanation

So answering your question:

I really wanted to post an answer that said "I think this is a very bad idea". Was I wrong?

  • No, if the question was "is this a bad idea?"
  • Yes, if the question was "how to do this?"

In the latter case, your "it is a bad idea" is technically not a answer at all, so you wouldn't be posting any answer just your thought.

  • 8
    This might be true for a help forum, but I feel it doesn't (always) apply to libraries of standard/canonical, high-quality questions and answers that these Q&A sites try to offer: "When you see a question that seems like it might reflect a common problem, don’t just answer it to get a few points. That doesn’t make the Internet any better. Instead, help us build up a library of canonical questions and answers that are more generic versions of the same question [...]" – Arjan Apr 7 '12 at 10:54
-9

No. It is nearly never a valid answer, not even for questions like

How can I do <...surreal, meaningless, harmful crap...>?

The reason is, that if a question asks for some bad thing, then a valid answer explains, how can the OP do that bad thing.

What they name the so-named "XY problem". The real cause of the so-named "XY problem" that sometimes our community wants to answer a different question and they enforce the OP to ask that question.

The correct behavior in this case:

  1. Explain to the OP, how can he do the crap what he wants, if it is possible.
  2. If it is impossible, then explain to the OP, why it is.
  3. Explain the OP, what will be the disadvantages.
  4. Optionally, you can explain to the OP, what would be the correct or better solutions to his problem.

The so-named "XY problem" and the "don't do it" answers are resulted by that the community wants to say only (4), instead of (1)-(3), extending it optionally with (4).

  • 3
    Quite often the "why" is just as important as the what. And this has less to do with the XY problem, and more to do with common sense. Consider a question on an appropriate site, asking how to floss one's teeth with a live wire. – Journeyman Geek Jan 14 '18 at 10:20
  • 6
    It's almost as if the people answering questions are experts and would recognise a fundamental issue that the person asking the question cannot, and respond to that issue instead of the superficial problem. – Nij Jan 14 '18 at 12:52

You must log in to answer this question.

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