I've been asked by various individuals about how to learn a new programming language, so in this post, I'm going to explain how I go about learning a new language. I'd also like to note that I'm making a distinction between a programming language and programming in general. Learning how to program would include not only learning the language of choice, but also some basic Computer Science Fundamentals.
When learning a new language, I always go to the language's website. For example:
These sites have tons of information about how to set up your environment and some resources that you can reference. I try to learn some of the basic syntax for the language using those references.
After having a basic understanding on the language, I try to create a basic project. I generally have a few I like:
- Setting up a REST web service
- Reading and parsing a CSV of my music collection
- Solving the ProjectEuler questions
Once I have some grasp of the language, I try to use it in personal projects or redo existing projects with the new language. The key here is to get used to writing more code in the language of choice.
I generally avoid reading text books or the O'Reilly book when I'm just starting out because they get very boring. I like being more hands on and I have personally found doing exercises or small projects have been the fastest way for me to learn a new language. Just reading isn't good enough of a substitute for practice. Those books become more useful later on when I want to learn a more advance concept.