Edit: I updated a lot based on the critique I got from Reddit. I appreciate it.

Programmers often say how simple programming really is. When you’ve already developed a programmer’s mindset, you can’t really see what the problem could be to a newcomer, who can’t understand code, no matter what. Many can even read code subconsciously, understanding the meaning of it without thinking about it too hard.

So, what do I mean with this mindset? Programmers work with programmers (and of course other people, but bear with me here). They all know how to write programs and how to reason about them. They have the right kind of mind to reason about everything with pure logic. They have the mind of a programmer or mathematician that can reason about abstract ideas with ease.

But what if you don’t have this mindset of seeing everything as a whole and paying attention to every detail? Some might not realize how you need to really understand what every single line of code does. This is not that rare, as many newcomers see coding as this magic glue to botch together individual snippets that do something, instead of realizing that code can’t, in general, be copypasted around If this is the case, you cannot understand coding. It’s not doable.

My advice to people trying to learn programming: Realize that everything you type matters. You need to understand everything that every single piece of code does. I recommend delving deep into the documentation if you’re not sure what something does over and under the hood.

Many new programmers try to botch together snippets they find from the internet. This is a great way to learn if you actually study, understand and modify the code you copy. If you don’t, you’ll learn nothing and you’ll end up with a broken mess and headaches. Understand your code. Spend a week studying a single snippet if you need to. This way you can slowly build the required mindset and intuition.

If you teach programming to people who have never programmed before, realize that your students most likely won’t have the correct mindset and you need to teach that mindset to them. No matter how much you explain what a snippet does and how it works, your students won’t get it if they don’t realize to think about what those statements actually do and what the big picture is.

So, teach how to reason about programming, instead of teaching the language. This way your students have a better chance of avoiding the too common pitfalls of not understanding loops or what an assignment does (both happen too often).

Whatever the case, it’s important to realize that for many it’s hard to build this mindset. For some it’s impossible. But it is this mindset that makes you a programmer. And if you have to work for it, it’s worth it. This mindset helps with everything that needs to be reasoned about.