"Learning by doing" is the best approach, but it takes extra care to learn as much as possible from the doing.
Shoveling in knowledge in the hopes of using it later doesn't work. Build on existing mental models or frames of thought you already have by "playing" with the material itself. For example, the Logo language built on children's existing experience of walking and turning by letting them program a turtle to walk around and take turns. However you learn the material, take existing experiences and use them to think of ways to play with the tools or concepts you want to learn. For example, I strengthened my Ruby knowledge by combining it with a love of anime and making a small program to scrape and gather anime images.
This requires more self-direction and will lead to more mistakes, but still adds up to good feedback and better retention. Having fun during the process is good and encouraged. Fun helps us get through the tough parts better and keep a healthy level of challenge.
When facing new and difficult challenges, try these approaches:
Break the problem down into small bites to tackle on their own
Look for similarities in other solutions you've done or are aware of
Don't stick to the old approach too much - learn from the differences
Make sure they're similar enough to be comparable
Debugging is solving problems we made ourselves. The value comes in learning from the error and understanding how to fix it. Start with "I don't know" and go from there.
As long as you get it right the final time, it's fine to fail however much you need to in the start. That's a key part of exploring new info.
This works only in an exploratory environment, which has a few requirements:
You're free to try different approaches for the same result (unit tests)
You can get back a stable state (version control)
Don't focus too much on the setup or other trivial code (automation)
Show progress and get feedback
We learn best by discovery (without words) instead of instruction. This often requires sensory exploration and real-time feedback. The author gives an example of an instructor who taught a women tennis in 20 minutes simply by having them observe the tennis ball's motions in various ways, and noting where they hit the ball relative to a chair.
For real-time, or situational, feedback, focus on a simple feedback loop like "hitting the ball X makes it land Y," etc. It's a quick and tight loop that encourages lots of discovery. All this focuses on the brain's R-Mode by using awareness without instruction that's relaxed and without criticism. Awareness without judgment, making an adjustment, trying again, repeat.
This works for programming by stepping away from problems or bugs and simply building our awareness of them without overthinking. Don't narrow in on why something isn't working - breathe deeply, take your hands off the keyboard, and raise your awareness and perspective. Look away from the code for a while if need be.
The core of the inner game is focusing on a feedback loop to grow experience, so learn how to listen properly.
Too much panic or anxiety about learning just right shuts down the mind and ironically makes it harder to learn. Specifically, the R-mode shuts down so the L-mode can go into overdrive, which removes all the needed benefits it brings. Allowing yourself to fail makes you less likely to since it eases the stress on the brain.
If this can't be possible at all times, creating "failure allowed" zones like brainstorming sessions, prototypes, and test environments helps.
The brain has a hard time distinguishing between real and imagined input sources. So imagining scenarios where you achieve success can help you achieve it in real life (yes, the book admits this sounds silly). Visualizing yourself surrounded by successful people has the same effect as actually being surrounded by them, making use of your mind's natural mimicking tendencies and becoming smarter.
Imagining and visualizing writing good code can have the same effect. It scaffolds on your existing skills to boost them. You can even imagine deliberately tougher experiences so the real ones feel easier by comparison.