Different approaches to learning programming
The opinions presented in this post are based on my personal experience as both a learner and a teacher. It is not based on academic research. If you're interested in learning more about teaching from academic perspective, I recommend taking a look at the publications of Mikko-Jussi Laakso from the University of Turku or Linda Mannila from Åbo Akademi just to name a few.
I was reading Viljami Kuosmanen's The #1 thing I wish someone told me before I started programming and it resonated very much with me. I've tried many approaches in learning programming myself and even more lately, I've helped a lot of people get their feet wet with programming.
In this post, I'll compare two approaches that are on the opposing sides of a single viewpoint: the ground up approach starting from theory and gaining good basic understanding versus the hands-on approach of creating software and learning as you go. To anyone looking for a quick answer on which is better: they are both good approaches.
The hands-on approach
I have organized and coached in a lot of workshops that take a very hands-on approach. Workshops like Rails Girls, Django Girls, Mimmit Koodaa and ReacTour have good guides that students can follow to build a modern web application. These workshops, running from 1 to 2 days, don't do deep dives into a single topic but give an overview to what goes into building an application: creating a new project, building models/database schema, backend and frontend code and deployment to a cloud service.
At the end of those workshops, you can share a link to your app to a friend and be proud in saying "I built this."
It's clear that you won't become a proficient developer in a two-day workshop copy-pasting code from a guide but that's not the point of these workshops. The point is to provide feeling of accomplishment, a peer group of people in the same situation and guidance to get started.
Once you have built this first application, building the second one – your own – become a magnitude easier. Instead of starting from nothing, you have something you can reuse, a guide you can fall back to and little by little start changing things. I'm sure many of us have had the experience of how it's so much easier to make progress when you have something in existence rather than starting from the scratch.
Starting with an approach like this doesn't mean you never learn the basics. Knowing these different parts and having hands-on experience in using them gives you multiple starting points to deepening your knowledge. If you're interested in building controllers on the backend, you can learn more about that. If you wanna get better at CSS animations, you can learn more about that. Now you know that they exist so it's easier to learn more about them.
The ground up approach
Another approach is to start from the ground up. This is the way I've taught in many university courses I've worked on. You learn about variables and spend some time modifying variables. Then you learn about if/else and spend time experimenting with different ways they can be used and combined. Then you move to things like loops, functions, classes, and other concepts.
Focusing on the basic concepts and having a solid base of understanding before moving forward gives you a great platform to learn more and to have a more comprehensive knowledge of the topics at hand. This is the way I learned my ropes of software development. I read a ton of books and had a desire to understand as much as possible before moving forward.
While this can be slower in the beginning (the time from start to having a deployed app can be very long), it can speed up your process down the line as you'll have more breadth in your knowledge base. You will be able to see different opportunities and options and avoid pitfalls because of this.
One thing I struggled with when learning programming this way was understanding how things connect to each other. I could write functions all day long but it took me a long time to understand how to build software beyond individual functions or classes.
Which one to choose?
The thing is, one isn't necessarily better than the other. They are different approaches and I recommend choosing the one that makes you happy and keeps you learning. They will converge eventually as your journey matures: those who start by creating software will have to deepen their understanding of the basics and those who start from theory and basics will have to learn to build things.
One thing I strongly believe about learning is that staying motivated is the key. It's really difficult to keep on learning something if you don't see progress, if you're not enjoying what you're doing and if you just force yourself push it through. If you start with the hands-on approach and feel like you're just doing todo apps and want to understand more, try out the other approach, get some books or classes and start learning that way. If you're learning the basics but feel like it's not taking you anywhere, take a break from that and build something even if you don't fully understand and master all aspects of it.
If there's one advice I'll give to anyone new to programming:
Pick a language/tool/framework/whatever and go with it.
There are no right or wrong answers to "which language should I learn first?" Any language you learn will help you in your path and one of the things that can slow you down is jumping from one thing to another every time someone recommends their favorite language as the best one to learn first.
One metric I would use when thinking about one is the size and activity of the community: how many quality books, guides, tutorials, Stack Overflow questions and answers and so on there are. Because you will get stuck a lot. And it helps when there's someone you can find to get help.
And if you know specifically that you want to build a certain thing: a website, a mobile app or a game, you might want to pick a language and toolkit that's aimed for it. But other than that, anything goes.
Especially in Twitter, I see a lot of discussion and opinions on whether one can start from React or if they should first master basic Javascript. And while knowing only React won't get your far (as React is a Javascript framework), it's a perfectly valid starting point. Create an app or two or three with it, learn how to make things happen, learn how to deploy them to a cloud provider and as your app grows in complexity, you'll have to learn more and more Javascript to be able to continue developing it.