I’d like to quote some lines from Peter Norvig’s masterpiece: Learn Programming in 10 Years:
The key is deliberative practice: not just doing it again and again, but challenging yourself with a task that is just beyond your current ability, trying it, analyzing your performance while and after doing it, and correcting any mistakes. Then repeat. And repeat again.
In any case, book learning alone won’t be enough. “Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” says Eric Raymond, author of The New Hacker’s Dictionary.
Also another amazing article that you’ll like to check is Herbert Klaeren’s Epigrams on Programming.