That often means that if the answer doesn't involve glittering golden code seeping perfection, people won't bother and will just answer: "Don't do that."
That often means that if the answer doesn't involve glittering golden code seeping perfection, people won't bother and will just answer: "Don't do that."
I've seen so many questions where the poster comes in and already 'solved' part of the problem by making false assumptions (note: this can be by accident, it's normal for novices and even more advanced programmers to have a lack of diagnostic insight) and then asks 'I want to do this, how do I do this?' which is at that point simply the wrong question.
Practical analogy to one particular style of questions: I have a lamp and a switch, and I don't see any light when I toggle the switch and I go to SO to ask how to replace the lamp. SO people could of course come up with a perfectly valid and acceptable answer and leave it as-is. But SO people might know better and realize such answer might not fix the actual problem, which could be a myriad of other things (no power, no wires, switch broken, I'm blind, ....).
It would be fine to help with all these other possibilites but part of your answer should... actually answer the question that was asked, as it was asked and not doing so should result in a servere punishement.
For me, questioning someone's question, asking more info, pointing out he/she might be doing the wrong thing, ... does not in any way involve me assuming knowing things better than the questioner or anyone. (e.g. for all I know, the asker is way more intelligent and wise and knowing than I am, but just temporarily confused - happens to me sometimes so can happen to others) Those two are orthogonal for me, it's just my nature to always question stuff. Including myself. And this certainly helps in finding solutions. And doesn't lead to me thinking I'm better. Perhaps different sometimes, yes.
your answer should... actually answer the question that was asked, as it was asked and not doing so should result in a servere punishement.
To stick with the enalogy: while the answer 'buy lamp, take ladder, unscrew old, screw in new' might perfectly answer the question, it is in my view completely useless if it doesn't solve the problem. So I'd leave a comment asking for more info. And if someone else would already have given that answer I'll probably leave a comment saying it's rather incomplete. Because it's imo the only way to actually help the OP. Why on earth should one get punished for that? Isn't it the right thing to do?
Well, this is exactly the problem I'm describing: you're trying to solve the problem for one user when the answer is for everyone who could ever ask something similar enough to come to the page from a search engine. So ignoring the question and solving the problem might help the OP but it doesn't help anyone else who actually needed to know how to replace a lamp. In fact it's hurt them because now "how to move a lamp" is considered solved by a lot of people but the actual page with the "solution" does not contain one.
But SO is a QA site - you are only supposed to answer if you indeed know better than the person asking!
I acknowledge there is a grey area with the so called XY question, where the questioner ask about one thing but actually want to achieve something different. But in such cases the correct approach is, in my opinion, to help the OP solve the actual problem they have, not lead them down the wrong path.
https://jdebp.eu/FGA/put-down-the-chocolate-covered-banana.h...
there is also the issue about the (missing) Standard Litany:
https://jdebp.eu/FGA/problem-report-standard-litany.html
particularly on a technical resource such as StackOverflow, lack of specifics are a problem (as they often don't allow for correct/effective answers), and in theory the OP asking should well know, being a technical person, the importance of providing background information when asking a question.
For example, let's say the title of the question is, "How do I reformat my hard drive on linux?" and the body of the question is "I accidentally screwed up my upgrade of Ubuntu by <doing XYZ> and now it won't boot. Can I reformat the hard drive and install again so I can boot?" If your answer is "Are you sure you need to reformat? Have you tried <solution to XYZ>?" then you may be solving OP's root problem but you will be making a useless landing page for anyone searching "How do I reformat a hard drive on linux?"
I don't think it is helpful to answer the literal question rather than the actual problem, since this is optimizing for a hypothetical future reader at the expense of the actual person having a problem. After all, the future reader might also have the same problem as the current user.
Which is fine because there are N potential future readers but only one OP.
You suggest answering "the wrong question" would help more users in the future. I don't see why that would be likely.
N could be less than 1
If you're worried about it then just answer exactly what was ask and follow your strategy. But please don't simply do your strategy because it's a real pain for those of us who end up having to move off the beaten path from time to time.
My point is just you should try help the person at hand with their actual problem, the X, and then clarify the question title to reflect the problem they need help with. It is easy to see if an answer have solved the actual problem - the OP selects the answer as "accepted".
If another person have a different problem which happen to be Y they will ask that as a question and get help for that. Everybody is happy.
I get really miffed when I see someone answering the literal question even when it is clear that the OP have a different problem and is just not knowledgeable enough to put it in the technically correct terms. I guess it is an effect of the education system when people think it is better to provide a useless but technically correct answer, than actually help people who have a problem.
Answering both X and Y is fine of course, and probably the preferred.
How many times have you seen that happen? Further that only occurs in an XY situation where the question was wrong. I've been hit by cases where the answer was "don't do that because it's bad". Well, I know that and I know why it's bad but I also know that I have to do it anyway. What now? You couldn't change the question in that case because they asked what they meant, they were just told that they were wrong (and they were).
>I get really miffed when I see someone answering the literal question even when it is clear that the OP have a different problem
And I get just as miffed when they don't because of all the times I get burned by people behaving as you want and then I can't get that same answer answered and have to go through even more pain (it was painful enough to be forced into the situation) to figure it out for myself. I have basically no karma on SO because when I get some I use it to vote down such people.
>Answering both X and Y is fine of course, and probably the preferred.
Here we can agree.
It is the OP which decides what it the accepted answer though, but the community should not upvote unhelpful answers.
Or the best answer follows the "here's how to do what you asked, HOWEVER: <detailed description of actual problem and solutions>"
And if the question is 10 years old the day I need to reformat my linux hard drive? The OP might not even still be alive. Certainly there will be resistance to rezzing a 10 year old thread to make the question more general.
If the question is "why do I get a segfault?" and we find out he's trying to write C code to title-case a string in-place, and he's passed in a string literal, we can edit the question to "Why do I get a segfault trying to modify a string literal?" or similar.
If the objection is that answering the real question will confuse people, then make the question match the correct answer.
"Some kind of help is the kind of help that helping is all about. And some kind of help is the kind of help we all can do without." -Shel Silverstein
- To get a sense of pride and accomplishment by helping people who have a problem. They want to dig into what the actual problem is, in order to help the person in the best way. The don't want to solve homework problems because they are not "real" problems.
- To get a sense of pride and accomplishes by answering technical questions as correctly as possible. This type of person might also solve homework problems posted on the site because they enjoy the challenge.
Both motivations exist, and they have different attitudes to the XY problem. You will se both attitudes in this thread.
But not many people will get a sense of pride and accomplishments by answering a question which could be found by a single google query. So why should they use their time on that?
> questioning the poster's motive
The motive can be important. Where there are multiple explanations and/or solutions this can filter out some that are not going to be relevant or practical for their current situation. Also where what they are asking seems impossible/impractical/misguided/other it can help in providing a better solution (i.e. trying to give them what they ultimately want even if it isn't what they are specifically asking for) or give context that might quieten your gut "don't do that" reaction.
The poster's motive is one of the most important bits of information: Where were you? What did you do? Why? What were you intending to happen? What happened instead?
> "Don't do that."
Sometimes "don't do that" or "you can't do that" is the only suitable answer though (such as where what they are trying to do is impossible, or just wildly impractical, or will open up a security nightmare, or there is a built-in method so they'd be reinventing a wheel, or one of many other reasons) with the important caveat that you don't answer with just "don't do that".
Better is "don't do that because <good explanation>" or "you can't do that because <good explanation>".
Even better still, if what is being asked it actually possible even if it is strongly recommended against: "You shouldn't do that because <explanation> but if you chose to ignore this recommendation you could try <method>".
If you expect a quality answer that actually solves the problem, explain everything. Provide clarification when asked to do so. Also, don't assume hostility and be friendly yourself.
And the reason is not about the OP, the OP is irrelevant in such a site. SO is a collection of programming knowledge. So the problem is that an experienced software engineer comes along years later, forced into doing something they already know is bad but have no choice for some reason (normally some silly job constrained that they simply cannot change), google search to see if anyone has done it and guess what comes up? The exact question on SO but with these useless answers. And since it has been "answered" no one else bothers any more. And I can't come in an clarify why I need it, it's not my question. If I ask again, my question will probably flagged as a duplicate.
If I could change only one thing on SO, it would be that anyone who answers "don't do that", in any form, without answering the question is banned from the site and their response removed.
And even then they probably don't know the answer, and you will have wasted your time and keystrokes. That's why I never attempt to justify myself to someone just because they want me to. If I anticipate that a question I'm about to ask will engender a lot of "why are you doing it that way?" responses, I'll usually address it when I ask the question, but long ago, I got wise to the people who seem to think that if they don't know the answer to a question, it's the wrong question.
E.g. a customer asks - can you make the button so you have to click it multiple times before it reacts? The less experienced (or more cynical) developer say sure, I'm on it. The more experienced developer (annoyingly) ask "what do you really want to achieve"?
That might be an appropriate response to someone in your own company. But when it's a stranger asking a specific question in a forum where such questions are asked, I give them the benefit of the doubt that they have good reasons for asking their question. If I can't answer it, I simply ignore it.
I realize that a lot of this comes down to asking hyper-logical pattern completers to stop being hyper-logical pattern completers. And that is in a sense one of the main motivations behind April Wensel's campaign to improve SO.
A bit of context like "I'm on an embedded platform, so I can't use heap allocation", or "the HTML is for an emai'l, so I cant use JavaScript" also goes a long way to avoid the annoying "why don't you just..." comments.
If you peruse SO you will notice quite a lot of questions simply does not make any literal sense because of misuse of terminology or just lack of understanding. Very often questions arise exactly because the person have a wrong mental model of how the system is supposed to work. Which means the question will reflect this misunderstanding in the way it is posed. Just answering the literal question is not helpful and in many cases simply not possible.
If you can't answer it, or don't want to answer it, then don't answer it. But please don't be the annoying, condescending know-it-all who is always there to provide an unsolicited lecture.
1) No answer
2) A technical explanation of how the 'view source' menu item can be suppressed (e.g. iframe, overriding right-click events and so on) which may at least work in some browsers some of the time.
3) An explanation why it is simply not technically possible to hide code sent over the wire to the client, and a suggestion to move sensitive code to the server if this is possible.
Clearly (2) is closest to the technically correct answer to the question... but it is it really helpful? Option (3) do offer unsolicited advice, which could be construed as condescending since this is not what was actually asked. But I will also argue this is the most useful response in 99% of cases.
But there might be some specific cases where (2) is actually relevant. E.g I'm building some kiosk-style console to provide an interactive quiz, and I don't want users to cheat by using view source to see the answers. In this controlled environment, it might be possible to completely disable "view source". So providing both (2) and (3) is the optimal answer, and should get the green checkmark.
But I simply fail to understand how giving no answer could be better for anybody?
> If you can't answer it, or don't want to answer it
Here is how I would rank answers from best to worst:
1. Give the correct answer to the technical question asked, and some background about when to think twice about using it
2. Give the correct answer to the technical question asked
3. Why you should rethink the approach
4. No answer
5. "Don't do it"
> Question: Hide Show content-list with only CSS, no javascript used
> Comment: Behavior is supposed to only exist in the realm of JavaScript.
But my favorite example is the following, which I sacrificed a couple of minutes looking for because the exchange was so instructive: [1]
> Question: How can I replace text with CSS?
> Comment 1: To be honest it might be best to use javascript for this.
> Comment 2: The question is how to do it with CSS. I am using a CMS that only allows me to change the CSS, which is why I arrived at this page while googling for the answer, and not a different one. That is why we answer the question that was asked instead of asking why the asker's situation isn't different.
The thing people forget is that the question is not just about the person asking it, but about people coming across the question e.g. through Google who have to waste their time sifting through idiotic non-answers. For better or worse, SO tends to be ranked highly on Google for development-related queries and I've come to subconsciously ignore it because of its uselessness, in general.
[0]: https://stackoverflow.com/questions/17731457/hide-show-conte...
[1]: https://stackoverflow.com/questions/7896402/how-can-i-replac...
The problem there is not the person commenting/answering being self-righteous, but the original poster not providing sufficient context for the question. People on the other side of the Internet are no more clairvoyant than anyone else, so aren't likely to guess that such a restriction is in play and currently unavoidable.
> That is why we answer the question that was asked instead of asking why the asker's situation isn't different.
Speaking of self-righteousness: when I see that sort of tone from someone asking for help I tend to walk away and go find someone else to assist (or something else to do entirely).
For me personally, it has happened a bunch of times that I Googled something, which led me to SO, where the answer was "Don't try to do it the way you're asking - the better way is X". I'm really glad I got those answers because I was educated about why what I was trying to do was bad and how to do it properly. The times where I really needed to do it the poor way are a small minority.
Then there is a single comment (not an answer) which says "you are not supposed to do that", which have received a single upvote.
You say "people won't bother", but in reality, 12 people have bothered and provided detailed solutions with code. What more could you want?
I don't really see the major problem here.
The second question has 23 answers, the top one having 186 upvotes. And then there is a single comment (not an answer), saying JS is more appropriate for this, and a reply from the OP explaining why it needs to be pure CSS.
Comments are for asking questions, request clarifications and providing information which does not constitute a regular answer. This seems to work exactly as intended. Several answers make it clear that the CSS solution is more fragile and worse supported than a JS solution, so I think it is pretty relevant to ask the OP (absent any information either way) if they couldn't use JS instead.
I really have a hard time seeing the problem here?
It shows -- the quality of the answer is quite poor.
> I don't think I agree with any assessment in which this is not an unqualified success.
This made me laugh. I guess the only assessment you considered is your own, which simplistically assumed time to answer is the most important factor.
And yet, not a single soul finding this question on Google cares if the answer took an hour or two days. Apart from you, I guess.
Are we talking about the same question? https://stackoverflow.com/questions/17731457/hide-show-conte... I'll admit that it's not always easy to judge if an answer is useful to someone else, but it looks to me like it answers the question, the user "accepted" it, and it has 23 points. What makes you say it's "poor"?
> I guess the only assessment you considered is your own
The only strike against it you cite is some push-back in a comment... What else do you have against it?
> which simplistically assumed time to answer is the most important factor.
On top of the user accepting it, it having 23 points, it answering the question, etc.
I mean, I think I would be pleased with the outcome if I were the OP. I think I would be pleased to find that answer if I came from a Google search. If you honestly think that this is an example of "people continuously questioning the poster's motive" and exemplifies what you don't like about SO, then yeah, I don't agree with your assessment. It's not an attack on you, chill out.
This comment should be deleted as it's blatantly off-topic and a waste of time. OK, let's forget about question one, since I found it in two seconds.
> Comments are for asking questions, request clarifications and providing information which does not constitute a regular answer.
> Several answers make it clear that the CSS solution is more fragile and worse supported than a JS solution
As you say here, the questioning ("clarification") of the question isn't limited to comments. It's easy to mentally ignore comments, but when you have to read through half an answer just to get past the BS... and besides, the CSS solutions in that thread certainly are fragile and bad, but that has nothing to do with CSS being appropriate or not and more because the answers are, well, terrible. CSS is perfectly capable of doing what the question asked for in a robust manner, and it avoids changing the page on-load which is a bad user experience (not that any web developers actually care...) and certainly no less fragile (assuming JS is even turned on in the user's browser).
The problem is people telling others what they should do, and I don't want random people trying to dictate what I should be doing -- especially not people giving answers like those. Actually, a couple of the answers are OK, and somewhat explanatory, but the rest are just BS that throw code at you, which is useless and a waste of everyone's time. To be fair, web development answers on SO are the lowest-quality generally speaking. I'm pretty satisfied with using SO for answers about e.g. Emacs.
> I really have a hard time seeing the problem here?
Uh, seriously?