What I tell all new programmers

I've been programming for over 20 years, and I've run about half a dozen introductory programming courses now. I've spent a total of around 1000 hours teaching programming. In no particular order, this is an assorted set of wisdom I say to all of my students at least once.

Welcome to programming.

  • Programming is really hard. No matter how good you get at programming, the only thing which slows you down is your ability to learn & solve problems. This seems to become more true as you get better at it. This is a fantastic trait - you will never be bored programming. If you are, you're doing it wrong and you should abstract over the set of code you're rewriting.

  • Programming is also one of the most frustrating things you will ever do. The normal experience of programming is to try to solve something, get frustrated, try harder, step back, have an epiphany and eventually get your program to work. Feeling frustrated is completely normal, and will never completely go away. (As you get better, you'll just attack harder problems and have the same problem). The sense of frustration will make solving the problem much more satisfying. You need to get comfortable working through that frustrating feeling.

  • No matter how frustrating your problems are, there is almost certainly a solution out there. As you get better at programming, you'll get better & more confident at getting unstuck yourself. This makes the sense of frustration get better, and will push you to solve ever harder problems. (They're no fun if they're easy!)

  • When we were kids, we were bad at everything but we didn't notice. As adults, we have very few opportunities to be bad at something. Embrace the feeling - it is totally normal, and you're doing something not everyone is capable of doing.

  • Know that your first hour of programming will be really different from your 10th hour, which will be really different from your 100th hour. This guy has been blogging about how golf has qualitatively changed while getting his 10 000 hours of the sport. Programming is just the same.

  • You are a wizard harry. Programming is basically magic. Think about it - we study hard and pore over our books of lore (the computer + internet), to make spells (programs). Wizards can teach other wizards how to cast their magic. We can make things happen in the world spontaneously, and create wonderous devices anyone can use. (Like the internet and mobile phones). These devices can do things that would be impossible without our skills.

  • Use the internet. Every problem you have in the first year you learn to program is a problem 100 other people have had before you. And all the answers are recorded online. The sooner you become effective at googling for programming help, the happier you'll be. Caveat: Don't ever take any code snippets you find online if you don't understand how they work.

  • As programmers, we carry around a toolbox with us whenever we program. The tools are all the tricks of our trade. The first things you learn (variables, for loops, etc) are like our screwdrivers and hammers. You will use them every day of your programming career. As you get more experienced, you start learning how to use more advanced tools, which are less generally useful but amazing at solving particular problems. (Eg, Tree data structures, A*, valgrind, debuggers, etc). Most fields of programming (gamedev, web dev, databases) will also have their own set of domain problems & solutions. As a result, any problem you've already solved will get a lot easier to solve next time.

  • Every program ever written is made out of code. You can read / modify / hack almost anything on your computer, and most of the other programs people have written. When it comes to computers, this is basically a superpower.

  • The best way to get better at programming is to write lots of code. Just keep making stuff. As a teacher, I'll try and give you a leg up when I can. But once you know enough, anything I can tell you you'll be able to figure out without me given enough time. Just keep coding. As a wise man once told me, "With patience, success is inevitable."

  • That said, read lots of code. There's lots of programmers who are more clever than both of us. They've written lots of code already that you can read if you want. It's probably on github.

  • It's said that the second programming language you learn will be the hardest. The first programming language will shape how you think about programs (seriously!), and when you learn your second language you'll have to revisit that. (Languages which don't break your brain a little aren't worth learning). After your second language, you'll get much faster at picking up new languages. I can learn enough to be dangerous in any given imperative langauge in a weekend now.

  • There is no 'best language'. Some languages & tools are better at solving some problems than others. As you learn different languages, don't try and port your old thinking to the new system. Instead learn how to program idiomatically in the new language.

  • Be playful. Be silly. Programming is a giant lego set full of fun problems waiting to be solved. Spend time making toy programs just for the hell of it. It's much more fun than whatever assignments you're given.

  • The best programmers constantly try to program ourselves out of a job. If you're really good at this, you'll never find yourself be out of work.

  • When you're stuck, write your program on paper. I'm serious. It's magic. This is standard practice in programming competitions. (I think it works because when you don't have to think about syntax you have more brain to solve the actual problem).

I'm sure there's other advice I've given out from time to time - but like most advice, if it's really important you'll figure it out on your own.

Happy coding :D

Edit: Lively discussion on reddit!