I think it is inevitable that people program poorly. Training will not substantially help matters. We have to learn to live with it.
It goes against the grain of modern education to teach students to program. What fun is there to making plans, acquiring discipline, organizing thoughts, devoting attention to detail, and learning to be self critical.
You think you KNOW when you learn, are more sure when you can write, even more when you can teach, but certain when you can program.
In programming, everything we do is a special case of something more general - and often we know it too quickly.
Everyone can be taught to sculpt: Michelangelo would have had to be taught how not to. So it is with the great programmers.
Dealing with failure is easy: Work hard to improve. Success is also easy to handle: You've solved the wrong problem. Work hard to improve.