I'll never understand the mentality of people who put themselves in a position of answering questions, but are genuinely perturbed by the prospect of helping people with basic/misguided/imperfectly conceived questions. If they're the kind of person who could just read the documentation and solve all but the most complex of their own problems, congratulations. They should feel free to set that as the bar for anybody you hire or collaborate with. Or even set it as the bar for questions that they answer, but don't penalize people who are coming to a Q&A for not living up to those standards. If you're of that disposition on such a site, you're probably more interested in stroking your ego and watching some arbitrary points accumulate rather than actually helping people. There are lots of hobbies in development that don't expose you to beginner questions: go join a more esoteric users group, or contribute to an open source project without looking in the users forums/chat channels. Just do something that doesn't involve alienating inexperience developers.
It's almost like you need to pivot the question at that point to be "how do I isolate problems?" or "how do I debug?" because the asker lacks those basic skills needed to ask a good question.
Both pointing out the problem with the code/methodology/etc. and helping them see something from a different perspective so they do better next time are valuable educational goals, and I don't understand why so many people think SO should address only one of them. It's almost as if people think coding problems are OK, but helping people with more amorphous skills is either beyond or beneath them.
Troubleshooting is a skill that can be taught— having someone more experienced giving you advice is an invaluable asset when you're trying to learn how to do it. Refusing to help people because they don't already know how to do it themselves helps nobody.
Stack Overflow isn't a free tutoring service, it's a collaborative wiki of answers to common programming questions.
That being said, I agree that the current culture of "you're doing it wrong" is toxic, and should be replaced with a culture of "here's how to do it right".
That's one of the goals. I wouldn't say it's the goal.
I would argue that the goal of any software should be to help the immediate user. If it is not, then why should the user continue using it?
Stackoverflow is successful because helping the immediate user has secondary benefits, namely that it also helps others. But that doesn't mean this secondary benefit should override the primary goal.
That's like saying "I as the immediate user of Wikipedia want to be able to upload my research paper and have it check if there are any mistakes in my citations. If Wikipedia can't serve that immediate need, why should I continue using it?"
Yet even if Wikipedia isn't good at auto-checking your homework, it's still immensely useful for the vast majority of other users who don't care about auto-checking homework.
You can't build software that satisfies everyone's requirements. It's okay if some users choose not to use your software because it doesn't fulfill their requirements.
StackOverflow is a Q&A site. Asking questions and receiving useful answers is the primary goal, and therefore the immediate users are the askers.
Ultra specific homework questions do not help the immediate users (readers) at all which is why it is frowned upon.
Sometimes, all someone needs is a rubber duck. We can help by becoming that rubber duck.
Its the long term goodwill that eventually brings new programmers into the field, because programming is hard! Newbies need to know its ok to take risks and there will be a safety net.
The solution may have been trivial - maybe even a single character fix, but this smells like you posted a wall of code and wanted someone to go through it with a comb for you. You likely got downvoted because you didn't provide a minimal verifiable example and instead posted way more code than was necessary to produce the bug.
If you post anything more than a few lines of code, you are probably providing TMI and need to spend more effort distilling down the problem. 9 out of 10 times, you'll find the root of the problem yourself during this distillation process, especially if the problem is trivial.
Then again, this is wild speculation, but I see this a lot when I am helping newbies.