In my experience, trying and failing is the very best teaching/learning method.
If you're observant and lucky during your career, you'll gain the skill of learning from other people's failures as well as your own.
(And from a management and mentoring perspective, it's important to assign tasks/projects to junior and mid level devs that have real risks of failure while shielding those devs from blame or blowback if/when they fail. All the very best devs I've worked with in my 30+ years in this game have a deep oral history of war stories they can dig into when explaining why a particular approach might not be as good as it seems on the surface.)
In my experience, trying and failing is the very best teaching/learning method.
If you're observant and lucky during your career, you'll gain the skill of learning from other people's failures as well as your own.
(And from a management and mentoring perspective, it's important to assign tasks/projects to junior and mid level devs that have real risks of failure while shielding those devs from blame or blowback if/when they fail. All the very best devs I've worked with in my 30+ years in this game have a deep oral history of war stories they can dig into when explaining why a particular approach might not be as good as it seems on the surface.)