In a recent blog post Eugene Wallingford says that when teaching:
I frequently pose a problem for them to work on for a few minutes before we look at a solution, or several candidates, as a group. All too often some students look at the problem, think it's too difficult, and then just sit there waiting for me to show them the answer. This approach often results in them feeling two kinds of failure: they didn't solve the problem, and they don't even appreciate the solution when they see it.
There is a double problem here, The first is that some students don't attempt to solve a difficult problem - giving up early. This leads to the second problem of not recognizing the beauty of the solution once they see it.
How can we encourage/enforce/demand/cajole students into making a good faith effort on a difficult problem without making them feel defeated at the end?
Often the exercises we give students have a learning objective that is more important than the actual solution to the problem. Learning is to be valued over solutions in a teaching environment. But students don't always see that and can be led to think of themselves as failures even when they work hard toward a solution (Authenticity Bias). We need to find ways to avoid that outcome while we encourage hard thinking.
The big idea here is that the effort to find a solution, even if it goes down an unprofitable path, will lead to learning. The practice of "stretching your brain muscle" is wort pursuing.
One Pedagogical Pattern was originally named Kobayashi Maru after a training exercise that was central to a certain Star Trek episode. In this pattern, the idea is to give students an impossible task to give them practice in very hard problems, possibly requiring orthogonal thinking. (The pattern was later re-named to Mission Impossible). That isn't exactly the same issue here, where we are looking to encourage deep thinking on deep but solvable problems.
This issue is not just about programming. It can be anything. For example a complex database design issue or a complex retrieval. Or in Compilers, some optimization issue that needs to run fast. Lots of opportunities for hard problems in any class.