I've done both ways and I think the answer is actually a little of column A and a little of column B. I think having a project or an idea that requires this new language is a great way to maintain motivation and consistency in learning, and I think courses have their place as well. I think a good idea is to learn a little bit, build something, learn a little bit, build something. You have to constantly be striving for something that is just out of your reach. I think the project method keeps you constantly striving for just a little bit more.
This question is probably aimed at beginners, because once you "get" programming, learning new languages will never be a problem. Reaching that stage, however, might take years. There isn't a single course or book that covers this field in its entirety.
Programming as a whole is a deep subject, with different languages serving different markets or functionalities. Your goal as a programmer is to learn how to deliver software, and in order to do that, I personally find that building applications is the optimal choice.
The core differentiator between programming languages is the syntax and input/output manipulation. If you take 10 different courses in 10 different languages you will probably end up knowing is how to handle forms and upload images in 10 different ways.
You will never learn how to validate, securely store or send the data. You will never learn properly structure your software according to an architectural pattern.
To summarize, if you want to become a programmer, then go ahead and BUILD, or read books.
Thanks for the reply guys. I've always found it quite hard not to leave a course mid-way and embark on my own little experiments. Learning is much more fun when you give yourself the freedom to fail/learn as you face a problem rather than preparing to not face a problem at all. It all depends on use case and time constraints, I guess.
100% any languages that I have really learned I was building something along side it. What i usually do is start with a programming language book X for dummies or an equivalent, find things like setting up my environment in a stupid simple format and common gotchas, and as I get more comfortable, i take the training wheels off and either go to a more advanced course or book or just use Google instead. Like Farouq said, after you learned a couple languages, it progressively gets easier to pick up new ones
👋 Join WIP to participate