12

I've got two examples.

  1. Someone has made some example code where they are trying to eval user input, so that "users can customize the website freely". They seem to be completely oblivious to the fact that the approach is... ridiculous and are only asking about something like "how can I make it so it does x" or "why am I getting this error".

Let’s say that what they are trying to do is entirely possible and the problem is easy to fix as well. Should I only answer what was asked? Should I answer and warn that this is not the way? Should I not answer at all, or give an answer where I basically implement the whole thing correctly from scratch and show that this one doesn't have the issue?

  1. Someone is asking about how to sum and fill some values of every row on a table, to the last column of every row. They have some example code doing this by using jQuery to loop through all the cells of the last column and to get the value of every other column than the last one of each row. Their actual question is, however, "Why am I not getting the value of column n of row m".

Should I address that the method he is using is slow, prone to errors, outright weird (because why would you read values from the DOM and not have some dataset behind the table to begin with), and unnecessarily hard to implement too? Should I just answer with a better method saying that this is a great deal better way to do this whole thing?

6
  • 2
    You should provide the answer that you can feel comfortable with. If that means providing commentary for future visitors about how the method is slow or insecure, do that. If you don't think it's worth the effort, don't.
    – Kevin B
    Jun 14, 2022 at 20:28
  • 13
    Above all, your answer will be judged not only on it's ability to answer the question asked, but also on how useful/correct/high quality future visitors find it to be.
    – Kevin B
    Jun 14, 2022 at 20:31
  • @KevinB Great point about future visitors. From that point of view, I myself would like to see an answer that tells me I'm thinking about it wrong, if that is the case. I also find it important, if someone new to programming were to google a question like that, that they would stumble upon an answer underlining that there are security risks, major performance problems or other issues if they'd do it the way they were thinking. SO has a lot of power honing and defining both new and old developers, that power should be used well.
    – Swiffy
    Jun 14, 2022 at 20:42
  • 1
    Start the answer with the right way to do the job and explain how and why it's better than what the asker directly asked for. The asker will probably pick it up and run with it. If they come back with, 'Wish I could, but..." then it's time to worry about whether or not it is appropriate to write the inferior solution, so long as it's possible. Jun 14, 2022 at 21:25
  • 3
    In the case of security risks, start by commenting and being explicit. "To be perfectly clear: it is your deliberate goal to allow anyone on the Internet to run any program they like on your server, and potentially store illegal material there, all at your expense?" Jun 14, 2022 at 21:26
  • 1
    Presenting a better way to solve the same problem can make a good answer. You can even post two different answers, with one mentioning the other, if some correction on syntax or details for the "bad" way would take too much space in one answer. (### Heading and --- hrule markdown are very useful for separating parts of an answer.) Jun 15, 2022 at 2:46

1 Answer 1

10

A former coworker refuses to use Stack Overflow. He got tired of having to justify himself every time he asked a question. His experience was that people would rather argue than just answer the question. He's not a newbie, and if you have concerns chances are he's already considered them.

My advice is if you can genuinely answer the question, then answer it. If you feel the need to explain why your answer is a bad idea, go ahead - it will make the answer stronger.

If you can't do that, maybe it's better to just walk away.

9
  • 4
    At least in the tags I'm active in, much of the time someone with an X/Y problem is trying X due to not understanding Y, not because they actually need X. Given the average question-asker, it's rare for someone in such a position to actually be an expert who actually has considered those relevant angles and is persisting anyway - though there are exceptions. It's not that answerers prefer to argue, but that they wouldn't want to post something they know is a Bad Idea™ 95% of the time. Commenting to try to get to the root of the Y problem can be more helpful than walking away. Jun 15, 2022 at 3:37
  • 1
    @CertainPerformance I'm sympathetic to the thinking here, and I've probably been guilty of it myself. But I think it's important to see it from another perspective, especially when people are driven away from StackOverflow as a consequence. Jun 15, 2022 at 4:31
  • 1
    Hum..., mixed feelings about this Answer: In my "Experience"/Tag, it's always the Askers that go "arguing" or refuse to explain/mention the 90% broader Context of what Functionality they actually want to implement even if they already have an "Idea" (= the "X" from the "X/Y")... which is often very cumbersome...! And the Quality of a Post/Qt should already demonstrate a bit the Tech Level/Knowledge of the Asker and should mention why they want the specific "X" if they are aware that their Qt might turn into some "X/Y" Discussion... 1/2
    – chivracq
    Jun 15, 2022 at 11:05
  • 1
    2/2 ... But the SO "simplified" Q/A Format can also been seen as a Cause for many X/Y Questions as Askers are a bit forced to only ask one specific Qt... If they try to give some broader Context and mention they might be "open" for a better Implementation, => their Qt will quickly be Closed as being "too broad and lacking Focus and Details" or "Opinionated"... Catch 22...!
    – chivracq
    Jun 15, 2022 at 11:09
  • 3
    @chivracq In my experience, SO is quite bipolar in general. While it wants to give users an extraordinary amount of freedom through privileges for example, at the same time it is very restrictive basically on everything. A lot of the rules here are ambiguous to the point that there are as many interpretations of the rules as there are users following them. Explain well, but don't be too broad. Don't ask questions with opinionated answers, yet one could argue that every answer is opinionated, as you can accomplish the same result in many ways. 1/2
    – Swiffy
    Jun 15, 2022 at 12:15
  • 3
    Include a lot of code, but get complaints for "code dumping". Show what you have tried / prove that you have made effort, but get flagged for not enough focus. Answer with a great code solution, but get downvoted for not explaining it. Answer with a great explanation, but get downvoted by not accompanying it with code. Then you go to meta and ask what a good answer is like and get philosophical answers saying "solution is a solution, regardless of the presentation" or "answer how you would like to be answered", but get flagged again in future for not providing references to documentation.
    – Swiffy
    Jun 15, 2022 at 12:22
  • 1
    Yep, agree with you @Swiffy..., and about "but get flagged again in future for not providing references to documentation.", for me, => was the Contrary, ah-ah...!, => got flagged (once) for providing (too much) reference to "documentation" (outside SO)...
    – chivracq
    Jun 15, 2022 at 12:28
  • @chivracq that should never be a problem, unless the answer consisted of only links to the documentation. Also remember sometimes people are just wrong. Jun 15, 2022 at 12:41
  • "A former coworker refuses to use Stack Overflow" - These kind of statements make me lose hope, the miscommunication around this is so strong it is no wonder that people confuse what Stack Overflow is for. I'm pretty sure your coworker uses Stack Overflow to find answers, Stack Overflow tends to be persistently at the top of search results. He refuses to ask questions, which is not the primary use of Stack Overflow. And that is great really, we don't really need even more of those.
    – Gimby
    Jun 16, 2022 at 10:02

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