Advice for beginner programmers

“When I write, I feel like an armless, legless man with a crayon in his mouth.” — Kurt Vonnegut

Programming can make you feel like that. It’s hard to wrap your head around a complex new world filled with intricacies, best practices, and alien-looking examples. As a self-taught programmer, these are some of the things I wish someone had told me when I was just starting out. None of them are specific to a single language – they’re more about the general mindset of learning to code.

About being on fire (and recursion)

For how many times my teachers told me to “stop, drop, and roll” as a kid, I thought I’d be on fire more times in my life.

It’s the same thing with programming terms like recursion — I thought it was going to be much more common than it is in practice.

If you’re just starting out, learn the very basics: variables, comments, functions, and so on. Tackle the harder concepts once you have a need for them. It’s much easier to learn something when you understand why you need to use it.

Lean into motivation

After you learn the basics, try to build something you’re curious about. For me, this was a WordPress plugin and a Zelda-like dungeon generator. You’ll learn faster and stay more motivated when you’re interested in the finished product.

Search for everything

When you’re learning to code, you’ll spend the majority of your time browsing the web for answers to your questions. Everyone has to do this – even Larry Page. (He founded Google.)

You’re not supposed to memorize everything!

Choose your favorite approach

In school, we’re taught that every problem has one answer. 2 + 2 is always 4, the author of Macbeth is always Shakespeare, and so on. Even with open-ended questions, like the “meaning” of a story, teachers are usually looking for one specific answer.

In software, problems can be solved in many different ways. There’s usually not a single “right way” to do something. There are many. They each have their own pros and cons. You get to choose which one you use.

Frustration and anger

If you get frustrated, take a deep breath and keep working.

But if you get angry, take a break.

The silence between the notes creates the music

When you’re completely stuck on how to solve a problem, you should step away to gain perspective. Your most elegant solutions will come when you’re not working on them. You’ll start to have brilliant ideas in the shower, or during a walk, or while you’re on vacation.

And they’ll seem like common sense: How did I not think of that?!

Use paper

Have a pencil and paper right next to you. When you encounter a problem, try drawing it out before you tackle it with code. My college roommate (a computer science major) kept a miniature whiteboard at his desk; the creator of Minecraft uses grid paper.

It’s amazing how much this helps.

Even your best efforts will sometimes be messy

I once heard that even the greatest developers can feel like their projects are held together with chewing gum and coat hangers.

All of your solutions might not be as elegant as you’d like. Learn to be okay with that. As you gain more skills, you might be able to revisit and fix them. But until then, you don’t know what you don’t know.

Comment to understand

In the beginning, you probably won’t be able to get through 5 lines of code without a comment. Mark up the code – every line if you need to – with clear comments in plain English. Walk yourself through the code, line by line, to understand what it’s doing. Sometimes it helps to say what it’s doing out loud.

Languages aren’t what you think

The learning curve for a programming language is less like a spoken language and more like a video game: if you’re a magic user on your first playthrough and an archer on your second, the core gameplay will still be the same. Or with music: if you learn the piano, you’ll have a much easier time learning the xylophone.

If you’re just starting out, don’t worry too much about which language you choose. Once you learn one, you can learn others much faster. Just pick something that looks readable so you can understand the core concepts.

For the record, here are some popular languages:

// JavaScript
function hello(name) {
console.log(`Hello ${name}!`);
}

hello("Mark");
# Ruby
def hello name
puts "Hello #{name}!"
end

hello "Mark"
# Python
def hello(name):
print("Hello " + name + "!")

hello("Mark")

Feeling stupid

It might seem like everyone is really smart except for you. You might beat yourself up for not instantly understanding “supposedly simple” concepts. The secret is that most people feel this way. They just don’t talk about it a lot, because really, who would want to hear that?

Everybody has to start somewhere. Some people were exposed to these concepts when they were 8. Some people were tutored by their software engineer parents. Some people were exposed to it in high school or college. And some people are teaching themselves much later in life! At one point, even John Carmack had to learn this stuff.

There’s no gatekeeper

In Harry Potter, there’s a magical hat called the Sorting Hat. It sorts new students into houses by their personalities — brave students are sorted into Gryffindor, cunning students into Slytherin, and so on. But if a student has a burning desire to be in a certain house, the Sorting Hat will grant them entry into that one instead.

Programming is like that: a desire to learn is all you need. You don’t need to be a genius. And while a computer science education can help it’s not necessary. You just need curiosity — which you have if you’re reading this post.