I completely agree with the claim "There is no substitute for doing", and I might even say that code you read without running and tweaking it doesn't count.
To learn how to implement computer programs, read books about it.
Also, "To learn how to implement computer programs, read books about it." contradicts the original comment's "There is no substitute for doing" more than I'm happy with.
You need to start by reading somewhere, or you'll probably not get anywhere, as evidenced by pretty much zero office grunts using web browsers every day having figured out the JS console and application development on their own without reading about it. I recommend books over tutorial texts.
But yeah, as I alluded to, you need to build stuff and learn from other builders.
I read about them and tried to apply them.
That's backward and didn't produce anything good.
I started to understand them by doing it the other way around:
- Coding, solving problems.
- Reading other people's sources.
- Then reinventing half a terrible design pattern.
- Later on, looking at a book: "ohhh, that's what I tried to do" or "ohhh, hence the snippet in that source".
- Now I can discuss with people about the pattern and name my code entities according to that.
Design patterns are a communication tool.
This may be good advice for yourself in the past, and for many people at lots of times, but I'd hesitate to give it as general advice. Reading code others have written should not be understated as way to learn valuable things from fundamental patterns and algorithms to language features and idioms. If you have a job in a team, this may happen anyway, but it's possible to write lots of code without realizing there's a better way.