There are two types of mistakes: intentional and unintentional.
The unintentional mistakes are the ones classical musicians make, hitting an E-flat when they meant to hit an E.
We often don’t welcome these. But you can learn from them, analyze why they happened, and take precautions against future occurences. Like sailing a boat that springs an occasional leak, you patch it up and get on with your voyage.
The intentional mistakes are the ones jazz musicians make, hitting an E-flat instead of an E just because they wonder how it’ll sound.
Making these mistakes is like exploring an ancient castle in the night. It’s too dark to see and you’re often bumping into walls, but bit by bit you get a feel for the castle’s layout in a way you never would have from someone describing it to you. And every once in a while, if you’re persistent, you’ll stumble into a room you didn’t know was there and discover a hoard of treasures the others were too timid to ever reach.
Unintentional mistakes, by definition, will happen of their own accord. You don’t have to worry about finding them. They’ll find you. But the intentional mistakes, you have to hunt for those.
That’s why, when you’re learning programming, you shouldn’t just follow along with the examples in the book, or the exercises on the website. Don’t let yourself be spoonfed. Instead, experiment! Take those examples and improvise on them. Stride out into the wilderness, beyond the edge of your map, spear in hand, musky scent of your prey filling your nostrils. Think to yourself, “I wonder what would happen if I…” and then boldly try it out.
Say you’re learning Python. What happens when you try to multiply a string by an integer? What happens when you try to append to a list the list itself? What happens when you try to pass a function into a function? I’ll tell you what won’t ever happen: something bad. Well, sometimes jazz can be less than ideal, but you’ll likely only be playing for a crowd of one.
But here’s the thing: you really need to develop a positive attitude toward both types of “mistakes”, because on some level they’re the same thing, two sides of the same coin. Our parents, our education system, and other institutions train many of us to be risk-averse, to prioritize mistake avoidance, and this must be consciously resisted. You can try to cognitively partition unintentional mistakes from experimentation, but in my opinion, a distaste of either bleeds into the other and ruins the whole enterprise.
It’s kind of like that chess movie Searching for Bobby Fischer. One kid, driven by perfectionist parents, gets to the top learning everything by the book. The other, who is able to see chess as a fun environment for experimentation and mistakes of any kind as opportunities for discovery, gets to the top with a philosophy of “creating chaos and finding the hidden patterns”. One is fearful, arrogant, and mistake-avoidant, the other emotionally secure, humble, and welcoming of learning experiences in whatever form they arrive. Guess who wins.
So get out there and do some damage. And if you do happen to stumble across a line of code that ruptures the computational fabric of reality and brings an end to the multiverse in one grand runtime error, well, at least you got to hit some interesting notes along the way. Not to mention there’s some serious karma waiting for you on r/tifu.