Yes, a lot of learning is by doing. But it is not always enough. Just playing an instrument doesn't make you a great musician. It helps to have the right talents. And those talents are not easy described. Programming languages always have come to me rather natural. I learned Algol 60, Fortran and Lisp primarily about reading a book and writing programs on paper. (I had to travel to another city and convert the programs to punch cards before I could run them.) It was only when I was a sophomore, when I learned something new about programming languages: lazy evaluation and currying. Just as with music, you need instructors, more seasoned software developers, that help you show to solve problems in different ways. It also helps to work at hobby projects or open source projects, to just experiment at programming things in a different way. Furthermore, I think it requires a lot of deep thinking. Spending away from the keyboard and just ponder about a problem, looking at the problem from a distance, is also very important. Last Friday, I spend the whole day at the office looking at some strange behaviour that I could not explain. It was only in the evening, while I was brushing my teeth, when I suddenly realized the cause.