The research cited below concludes that, at least for older students, building struggle and even failure into lessons results in deeper learning. As teachers we should consider how we can move more of the thinking onto students, including letting them struggle a bit with solving problems or issues prior to direct instruction or giving them the solution (or even how we would solve or answer the question).
While we want to be aware of the potential to frustrate certain students, having them wrestle for solutions and make mistakes can have great benefit for their learning and retention.
From the introduction to the linked article:
"When learning a new concept, should students engage in problem solving followed by instruction (PS-I) or instruction followed by problem solving (I-PS)? Noting that there is a passionate debate about the design of initial learning, we report evidence from a meta-analysis of 53 studies with 166 comparisons that compared PS-I with I-PS design. Our results showed a significant, moderate effect in favor of PS-I..."