The best way to learn to program is through trial and error by working on projects that interest you. There's no substitute for solving problems mostly on your own, and for seeking out help only when necessary. The DIY approach makes concepts real and memorable because you've implemented them, rather than reading material that may be forgotten.
To do so, you need a foundation, some level of familiarity with the syntax and patterns in whatever programming language or framework you've chosen. Before you can begin making progress on your own, you need some sense of basic programing concepts and the scope of possibilities.
The Web, a labyrinth of code, is full of educational resources that can help you lay that foundation. In many cases, no money is necessary -- free tutorials and help forums abound -- but a bit of cash can accelerate the process and help you achieve the technical competency to exercise your programming abilities on your own terms.
It's worth making a distinction here between beginner-to-intermediate programming, a level useful to individuals and businesses and attainable through personal inquiry, and advanced programming that requires a solid foundation in mathematics, computer science, or other specialized fields. If you want to create your own browser, programming language, or machine learning system, you'll probably be better off enrolling in a reputable computer science program than trying to cobble the necessary skillset together through online tutorials.
I taught myself BASIC in the 1980s but decided in college that I liked writing for people better than writing for machines. Following the advent of the iPhone, I decided to get back into programming in 2009 using Corona SDK, a Lua-based game development framework. I chose it because it allowed me to write apps that could be built for both iOS and Android devices.
A few years later, I tried a Python course at Marakana, a San Francisco-based training company subsequently bought by Twitter. But it wasn't until I started practicing on a more regular basis with Codecademy and Learn Python the Hard Way that I felt I was making progress.
Since then, I've tried Thinkful, Code School, Coursera, General Assembly's Dash, and Udacity. Treehouse is next on my list. And I have high hopes for CheckiO's Empire of Code, a real-time strategy game based on coding.
What follows are a few of what, in my opinion, are the best educational options out there to reach a moderate level of skill as a programmer. Feel free to tell us about others you'd recommend in the comments section below.