I personally think that both are valid methods to learn, but that you learn different things from going the separate ways. i.e. when I'm writing something from scratch I have to learn every little detail of what I'm trying to do, whereas taking a look at someone else's code I could gloss over a lot of the implementation details but learn how the author decided to implement some of the relevant/important parts, how to extend, and otherwise generally contribute to a project.