And even if we are often learning by looking at parts of someone's code, this program does not have to be open source. I personally have learned to program by looking at proprietary code while working in a company and then learning things by asking questions on forums, using functions, submitted by people and adopted from their usually proprietary software. Only once in my web development career did I have to literally go through the whole code of a phpBB forum. But by that time I already knew how to code.
In other words, I am not arguing that looking at someone's code is unnecessary, I am arguing that having complete code of a program is usually not required to learn to code. It is good sometimes, perhaps it is very useful, but this is not necessary. Many people learn to program without being exposed to a complete open source project.
Another important point is that when you are working in a company, other people's code is not the only thing that teaches you. Often, there are also people in the company who will actually walk you though the code. Just having the code available is not necessarily helpful.
How can my argument be defeated? With evidence. It would be interesting to see stats on major contributions to learning to code. If this data contradicts my argument - I would definitely follow the evidence.
But using "background knowledge" about the world, it seems to me that most people know little about open source and are unlikely to learn by opening a program they like and start reading through the code.
I could be wrong and maybe majority of people do exactly that. but I am not aware of any such stats, neither am I aware of how this could help a novice learn to code. I had to change things in a complex C++ program written by one of my science professors. It did not teach me anything. But it would be wrong, of course, to make generalizations based solely on my own experience.
An
interesting thread at Quora on how people learn to code and advices people give. So far I see no advice like "open an open source program and look at its code".
And, finally, to address Rui's point:
"unless you're the creator of the language, which i'm sure very few
humans can brag on that, you always have to look into someone's "code",
even before thinking on developing on it--any language, any code,
lexical, grammar, syntax, or style, be that an idiom, dialect or just
accent."
I agree that you have to look at someone's code. But, using your language analogy, I don't think that I can learn Spanish by opening someone's book and trying to read through it. I would actually start with a textbook and simplistic texts.
So, I am not arguing against not looking at anyone's code. I am saying that you don't need complete open source programs for that and if a person is never once exposed to any open source "free" software projects, he has dozens of methods to learn to code and I, in fact, argue that looking at open source projects is not the most common way of doing it. Remember, I am arguing against the fact that "free" software is so good, because it is (presumably) the only/best way to learn.
I argue it is *a* way to learn. And it is not a strong argument to justify GPL software as a necessary thing.
And, finally, people rarely "know a programming language". You still know only parts of it and only certain applications. Even if you know a lot about C++, it is applied differently to graphics, it is applied differently to GUI, differently to sound, differently to text, compression, databases, etc. Each application requires specialized knowledge.