For many questions, especially for people introducing themselves as new users of a language, you can usually see in the question some important misunderstanding about how the language works or about programming in general.
While I know that Stack Overflow is basically for Q & A, does it really help to just give a technical piece of code which does what people are asking for, but that we know that they are probably not able to understand it? This is usually what I see in the answers. Shouldn't we rather in these cases just explain the main misunderstanding in the question and redirect to appropriate resources?
You can see an example here: R: Perform multiple if conditions across two data frames of different length using for loop. Answers are given using some libraries, while it is clear from the question that the usage of if
statements in R
is not understood. In addition, in many such cases, the question is quickly edited afterwards to ask about the next step.
Usually, I'm also tinkling about it when giving an answer: should I give just a working solution or should I also explain what was wrong and how my proposed answer works?
Even if teaching is not the goal of SO, as the proverb says: "Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime".
What do you do usually do in such situations and what would be a good practice?