Why is learning to code so hard?

A comment I’ve heard from many people is :

“I’ve tried to learn coding so many times, but it never seems to click.”

Is this something you’ve said in the past? Don’t worry, you are definitely not alone. Having taught multiple introductory programming classes before, I’ve noticed this is a sentiment shared by a lot of newly starting developers.

Learning to code is hard. And while it is true that some people find it easier to learn programming in comparison to others (whether due to higher levels of interest or an aptitude for logical/mathematical reasoning), the way someone goes about teaching themselves to code will impact the likelihood of them developing and retaining those skills.

It is very tempting, as it is when learning all new skills, to jump straight into creating the cool things. Like crocheting a jumper, or baking a twelve story croquembouche. It is important to differentiate between your end goal (what you want to build), and what you need to know/learn in order to meet that goal.

Along with that, there are various skills you should develop that will aid you in tackling any blockers or errors you may face when completing a project.

In this article I will be discussing my top tips I’ve shared with hundreds of past students that helped them grow in confidence and ability, as well as the tips previous mentors have shared with me.

Why is it so different to learning other skills?

Learning to code is often likened to learning a language or an instrument. So methods such as spaced repetition are regularly recommended to learn new programming languages, just as you would with learning any language. As much as this is a helpful way of learning, it is important to acknowledge the differences between learning a programming language and human language. The main difference being:

There is no margin for error when writing code.

Let’s say, for example, you are learning to speak French. You practice your French by making conversation with a fluent French speaker. If you were to mispronounce a word, or jumble up the order of words in a sentence, it is likely the other person will still understand what you were trying to say and a conversation will continue. Unfortunately, a computer does not have that sense of intuition. There is no “close enough” in programming — only right or wrong. That’s what makes it so difficult.

If you were to ask any person with coding experience, I’m certain they would be able to recall multiple times they were stuck on a silly bug for hours if not days because of a spelling mistake or syntax error. And if they can’t… well they’re lying ! I’ve personally felt the embarrassment of being stuck with broken code for hours, only to realise I wrote “docmuent” instead of “document”, or raged when I couldn’t connect to my server only to realise it was running on port 8888 instead of 888. A human can understand what was meant to be said, but a compiler does not have that ability.

The unforgiving nature of code is what makes it such a difficult thing to learn. It is also the reason why it is vital to develop a handful of important skills that both limit mistakes made, and enable you to solve and debug errors in order to move forward from those mistakes.

What skills should I learn?

If you are trying to learn to code, it is important to first learn the following four things:

  1. Core programming concepts
  2. Problem solving strategies
  3. How to debug your code and
  4. Core features of your chosen language

Core Programming Concepts

It is one thing to copy out an answer you saw on Stack Overflow. It is another to understand what you are writing and what it is accomplishing. It is near impossible to learn how to code without first understanding fundamental components that code is made of. Good things to research first are:

  • Variables & Primitive Data Types
  • Compound Data Types (Strings, Arrays, Lists, HashMaps)
  • Memory Allocation
  • Loops
  • Boolean Logic

There are various online courses available to teach you these concepts, as well as countless Youtube videos. For the most part, these are transferable skills across different languages.

Videos by “The Coding Train” are what I watched when I first started learning. Another great resource is “Code Academy” if you are looking to challenge yourself and receive feedback.

Problem Solving Strategies

Once you’ve got the core concepts down, you should spend some time practicing completing functions to expose yourself to different scenarios and generate your own strategies for how to overcome them.

Expose yourself to popular searching or sorting algorithms. Practicing implementing well known algorithms will assist you in developing a better understanding of computer science concepts. Plus, the more practice you get, the better you become at problem solving. This may take a bit of time to improve at, but it can also be very fun.

Here are some fun resources to practice with:

  • Cracking the Coding Interview: unpacks common questions given in coding interviews.
  • Coding Bat: I used this all the time when I got started. Getting a gold star next to completed problems also feels super rewarding.
  • Leet Code: Another great tool for practicing interview questions.
  • Geeks 4 Geeks: Fantastic write-ups unpacking popular algorithms and core programming concepts. Great for refreshers on topics you may not have visited in a while.

How to debug your code

When your code breaks it is important to ask yourself: do I understand what I’ve written? Is this broken because I lack understanding on the topic?

Odds are, you will encounter many MANY errors throughout your journey. Experienced programmers still come across various bugs and challenges they need to unpack every day. The difference between experienced and unexperienced developers is that the former have effective strategies on how to debug and unpack issues in their code.

The best way to debug your code (especially as a beginner) is to print variables to your console or using debug tools built into the IDE you’re working in. You will gain a better understanding of your code by stepping through it line by line to find the source of your issue. Tracing things in your head can also get super tricky and complex. Try creating memory diagrams and tracing your variables on a piece of paper as you step through code.

The more experience you have encountering problems, the better equipped you’ll be with dealing with them in the future. Don’t feel disheartened if you are making a lot of mistakes initially — we all make mistakes, and the learning curve is different for everyone. Take each mistake as a learning opportunity — you’ll be surprised how quickly concepts will come to you later when faced with similar problems

Core Features of your Language

Do a bit of research on the language you want to learn. This isn’t exactly a step, but more something you should be doing and learning by default when learning concepts and practicing problem solving. No doubt you will come across various errors and bugs you cannot explain. By researching syntactical standards of the language of your choice you will be able to identify these mistakes earlier. Maybe try and organise a time to chat with someone who has experience with that language and ask for their tips.

Another thing to consider is what type of things you are wanting to build. This will impact which language will be the most appropriate to learn. If you are planning to build iOS apps, Swift would be a worthwhile language to consider learning. If you were hoping to build websites, Javascript would be more appropriate. Do your research and ask for advice. There are so many languages and tools out there, it is important to try and find the one with the most appropriate features and functionality to suit your goal product.

* * *

Extra Tips

  • Get yourself a mentor. There is nothing better than having a person to explain your problems to without fear of feeling stupid. Their support will be invaluable throughout your journey.
  • There is no indignity in asking for help. I know I keep repeating myself, but mistakes are part of the learning process. It does not make you dumb, it makes you efficient and resourceful.
  • Get yourself some buddies. Learning to code is much easier when you are doing it with a group of people.
  • Teach someone else. Teaching is one of the best ways of learning, so once you feel comfortable with topics, have a go at teaching someone else what you’ve learnt.
  • Start good habits early. Things like naming your variables and functions meaningful things, leaving code comments and using version control. Future you will thank you.
  • Take notes. There are resources all over the place, try and collate some notes just for yourself to reference.
  • Google is not always your friend. Knowing how and what to search is something that comes with experience. Instead of searching for a solution, search for things to help you better understand your problem so that you can come to your own informed solution.
  • Buy a rubber duck. I’m serious. Tell it all your problems, and in explaining your problem you might answer your own question. Talk in mirror
  • This is a bit of a stretch goal, but look into testing. It is important to trial how your code responds to a variety of different edge cases to ensure it works the way you think it does.
  • Lastly, and most importantly, don’t expect to know everything straight away! Imposter syndrome is so so common in the computing and engineering community. My friend Grace wrote an amazing piece on Imposter Syndrome I’d recommend reading. It is easy to compare yourself to someone who seems to know everything. But try and remind yourself that everyone started somewhere and everyone has been in the position you’re in now. Its a sucky feeling, but if you persist with it and invest the hours, you can be just as knowledgable as your friend with the insanely busy Github profile.

The best and worst thing about programming is that the learning never stops, and technology continues to evolve and change. Be patient with yourself, set up a study plan, and practice, practice, practice!

28