How to Learn to Code

If you are a beginner to the realm of software engineering, this post is for you.

Like many of my peers, sitting in programming help chat rooms and donating time to help software development newcomers find their footing is a pastime. It’s the right thing to do, if you have the ability, the knowledge, and the time. If you can make an impact for aspiring developers you will probably take the opportunity to do so. In fact, I feel an obligation to do so. I would not have the level of knowledge I have now without the help of my anonymous chat room mentors (Thank you!).

During this time I’ve noticed an approach some beginners take that I don’t believe is helpful. These are the kinds of questions I find myself drawing conclusions from:

“Do you guys have any good resources to follow after learning the basics of C++”

“I can’t really find any resources for self-learning programming”

And yes, these are direct quotes from chat room history. Don’t get me wrong; the questions are not malformed, but they hint to me an underlying issue that I find many beginners getting trapped by. First, let’s talk about learning retention.

The Learning Pyramid

I’d like to introduce to you the good ol’ learning pyramid.

learning pyramid

This image represents student retention rate as a percentage for the given learning method. The three highest retention rates in this model involve the application of knowledge with “Immediate Use of Learning” proving the most effective.

Now, to be clear, nothing about this model is scientific, but I don’t think anyone would disagree that actually doing a task is the best way to learn more about it. Take trade schools for example: whether you’re doing welding, HVAC, plumbing, etc. you will be learning by doing. You will gain the necessary domain or safety knowledge to begin and then as soon as possible you will be practicing the trade. Hell, you might even do an apprenticeship to gain real-world knowledge as well. This is how a quality software development education should be viewed.

If you’re spending your time reading programming resources and following tutorials directly, regularly checking against a guide to ensure your program matches the example, you’re almost surely doing yourself a disservice. Your success in following a guide lies in your ability to grasp the concepts, not to type a working program. Or, even worse, if you’re just reading to learn programming then you’re in for a rude awakening when you’re staring into an empty file wondering what to do.

So, what can you do?

It’s simple: just follow the learning pyramid. The most important thing you can do when you’re learning is to formulate a small and feasible project idea to provide you with direction. There’s plenty of small programming project ideas on the internet, but if you can come up with one yourself that aligns with your interests go for that option.

Once you have your idea, do your best to begin an implementation of it. Pull up any resources you think will help you and immediately apply them. The most important thing here is syntax, it’s what you will be battling most often as a beginner. Programming languages are quite particular about things that might not make sense to you yet. That’s okay! Keep going; you don’t have to understand everything right away.

Remember, the internet is your friend. There’s information online from people who’ve run into the same problem you are having. If you’re stuck, join any beginner programming chat room (Discord, IRC, web forums, etc.) to receive help. Describe what you’re trying to do, show them your code, listen to their response, and fix your code.

Chat room helpers often will try and lead you to discover the right answer yourself. It may feel frustrating, but play their game and you will learn. This is the discussion level of the pyramid.

Finally, after falling on your face hundreds of times, you may have a working program. If it works, post it in a chat room to have others criticize your code. If you cannot get the program working or your idea is too difficult then choose a simpler project, aim lower, and try again the next day.

Here’s a handy diagram of the workflow I’m suggesting you to follow. diagram

Final words

I like to end every blog post with takeaways you should leave with.

  • Learn by doing, have resources available to assist you and apply them.
  • Understand that learning to program involves making thousands of tiny mistakes, you can recover from them!
  • Get help. Thousands of developers lurk in different chat rooms wanting to assist you, the programming community is amazing in this aspect.
  • If you cannot finish your project, aim lower and try again.
  • If you can finish your project, post it in a public chat room and ask for critique.