How to Learn to Learn to Code

*This post was first published in Break In, a newsletter for people learning how to code, looking for their first dev jobs, or working hard as junior devs. Break In shares real experiences and advice from real devs who have been through it before. Subscribe to get our bi-monthly newsletter, start asking questions or even contribute your own experiences.

Why You Need to Learn How to Learn

Learning X programming language is easy--you can follow along with a tutorial, read some documentation and understand the basics without too much trouble. But what happens when the training wheels come off? When the tutorial you were following is over and you're left to build your own projects and face your own challenges?

For this reason, learning how to code is about so much more than learning a specific programming language. You need to learn how to stare down the toughest challenges without flinching; you need to learn how to seek out problems to solve instead of shying away from them; you need to develop a set of tools that you can use to solve any problem, not just the specific problem laid out for you in a tutorial or lesson plan.

How can you gain these skills?

Learning to Love the Challenge: A Guide

Take responsibility for your own learning

Focus on problem solving skills

Don't isolate yourself

Brag about it

Take Responsibility For Your Own Learning

If Your Code Doesn't Work, It's Your Fault

One of the most common things I hear beginners say when struggling with their code is: "It doesn't work."

That one little statement really reveals the perspective that you need to fight against. It implies that your code is the thing that has the problem, not you. Well, I have some bad news for you: you wrote that code.

Instead of saying "It doesn't work", try "I didn't do it right." This slight shift in thinking will open you up to looking for your own mistake. You can let go of the frustration that you've misdirected at the abstract concept of "your code". This frees you up focus on identifying what you did wrong, or what it is that you don't understand.

Focus on Problem Solving Skills

It's Up to You to Fill in the Blanks

What happens when you're following along with a lesson, tutorial, vidoe or in-person class and the material provided to you doesn't sufficiently cover a certain topic? What if you're given an assignment but you're missing some of the understanding you need to complete it? Or (heaven forbid) what if someone like a teacher or tutorial author gives you incorrect information??

I've seen students deal with this problem, and I've experienced it myslef. When this happens, its easy to feel like you've been given the short end of the stick. You signed up for this class/bought this video course/invested time in reading this article, so it should tell you exaclty what to do, right?

Wrong.

As a professional developer, almost no one will tell you exactly what to do, ever. So, the frustrating experience of missing some information is actually an opportunity for you to learn a critical skill: how to do something that you have no idea how to do.

Accept the premise that you won't always be handed exactly what you need to solve a problem. Let go of the resentment that situations like this naturally cause. This will allow you to rise to this challenge and maybe even enjoy it.

Instead of wasting time being frustrated or angry that you don't know how to solve the given problem based on the material in front of you, branch out to find new resources. Google the topic your struggling with, ask questions online or to other people you are learning with. Experiment with different solutions just to see what happens.

In the end, you'll learn way more than how to solve problem X, you'll learn how to tackle any problem.

Don't Isolate Yourself

This brings us to our next piece of advice. Always remember that you are not alone in learning (and struggling to learn) to code!

Programmers are naturally curious and helpful people and if you look around, you'll find robust communities of beginner programmers, along with more advanced developers who just want to help.

So, when you're stuck trying to squash a nasty bug in your code, solve a tricky challenge, or just working hard to master a difficult concept, remember you have so many avenues for help and support open to you. You can:

Google it! Developers at all skill-levels Google things every day. This is a real and valuable programming skill and you shouldn't shy away from it.

Ask a question on a forum like Stack Overflow. Stack Overflow exists because people want to help you solve your problem. Use it!

Go to a meetup. There are lots of excellent meetups geared to beginner programmers, as well as meetups that function as study groups with people volunteering to answer questions and help out. Get out there and meet some other programmers!

Ask a friend or classmate. If you're taking an online or in-person class, talk to the other humans learning to code with you! They almost certainly don't bite and are very likely to be struggling with questions of their own too.

Brag About It

If you've ever struggled with a difficult concept, spent hours trying to get your program to do what you want it to do, or squashed a particulary nasty bug, you know how good it feels when you finally reach your goal. Celebrate that feeling, and spread that newfound knowledge around.

What you just learned has lasting value for you and very likely for other beginners out there. So, next time you get through really tough challenge, write a blog post about it on a platform like Dev.to, share what you learned with a friend or classmate, or consider going on Stack Overflow and searching for similar questions that you can provide an answer too.

By doing these things you can up the value of the reward you get for solving problems, which will inspire you to find still more problems to solve.

Let's Get Lost

If you follow this guide, you will learn how to love the struggle of learning to code. You'll learn to love that 12 a.m. problem solving, falling asleep over the computer and dreaming of code, waking up and fixing the bug feeling. You'll want to chase that next bug, that next lost-in-space code problem, so that you can keep learning.

Doesn't sound that helpful really, BOTH cases are common when you're working with code. Sometimes 3rd party code, or code written by your colleague etc. doesn't work, sometimes yours doesn't.

Playing the blame game is usually completely unproductive, it doesn't matter if it's the problem of a 3rd party library, your code, or your colleague's code, what matters is why doesn't it work and how to fix it. Similarly I see people use IDE annotation + version control "blame" features to find the person to literally blame for a problem, which is not ok. However those features can sometimes be used to find a person who could help you out, if you're actually stuck or in panic mode.

The important bit, like the post says, is that something doesn't work and you don't know why, and you need to figure it out. Learning to debug, to figure out which parts you're absolutely certain work correctly, is one of the most useful skills as a programmer.

Learning to figure out which bits to debug is probably one of the most difficult things, e.g. instead of trying to figure out if "arrays are not working right in your programming language" (hint - they're probably not), you could try to figure out what's being stored in those arrays for real.

Also finding the careful balance of trying to figure things out for yourself and when to ask for help is a difficult one - one decent guideline is that if you can't explain the problem to someone else, you probably should try for a bit longer. E.g. "it doesn't work" is not an explanation, but "user registration is failing, apparently this check is failing here, but I can't understand why" is already some sort of a starting point.