Learning to Program

By Will Angley
08 Feb 2016

This post tries to do two things: tell a story about how I learned to program when I was younger, which has been one of the most defining skills I’ve learned yet, and answer questions about learning how to program today.

I’m far from being an expert on this, but I hope this is good enough to be helpful. And, if we’ve met in person and you’ve asked me how to learn how to program, good enough that you don’t feel like you needed to take notes.

And just to reiterate, this is my personal perspective - not my employer’s.

Learning to Program

What does learning to program look like?

Programming, in this sense, is making a computer solve problems for you.

You communicate with a computer by writing in a programming language. These are simpler, and follow stricter rules, than a natural language like English or Chinese.

Most people learn these languages by example, and writing small programs that follow exercises in a workbook or a course. Once you write the program, you ask the computer to run it. It will the either tell you “I don’t understand,” and say why, or give you an answer.

If it gives you the right answer, you can start another exercise.

If it doesn’t understand, or gives you the wrong answer, you’ll have learned something anyway. And then you can fix your program and try again. Mistakes are part of learning to program, and they’re part of writing programs for a living too.

How did you learn?

I learned GW-BASIC, running on an IBM PC-XT, using a paper workbook called Kids and the IBM PC/PCjr.

There were also a couple of the Creative Computing books there, and I spent a lot of my screen time typing those in without really trying to understand them. Or trying to understand them just well enough to make them run on that computer. That was good practice for a lot of my daily life since then.

This was all found equipment; it was in a classroom that I found myself in at the time, with a teacher who was willing to let me use it when I had gotten ahead of the class. I later learned that it was older than I was, and was what much of the generation before me grew up on.

I didn’t actually talk about programming with anyone else in person until several years after I’d started programming. And I didn’t take my first programming class until several years after that.

Should I do the same thing?

No. I liked the style of the workbooks I used, but they’re long out of print and the languages they covered are dead.

Also you shouldn’t learn alone if you can help it. Your life is probably way more interesting than the primary school classrooms I was in at the time, and you’ll want the extra support to help you stay on track :smile:.

What language should I learn instead?

The best way I know to make this choice is:

  • If you know programmers, especially ones who are excited about what they do, you should talk to them about learning programming. Sometimes you’ll find you already have a community around you that way. Pick the language they will help you learn how to write in.

  • If you’re choosing from a blank slate, or have many choices, I like Python. And I get to use it at my day job, which is nice too.

  • You might have found most of your programmer friends talk about Ruby instead. I’ve seen Ruby work well for beginning programmers too.

  • More programmers are starting with Javascript nowadays. I know people who have had good success with this in training courses. But I don’t know as much about starting with this in self-study, and won’t talk more about it.

These are not the only options; just three that I have seen work, and that have good Free implementations you can run at home. It’s more important to get started, and get regular practice, than to pick one “right” language.

A programmer who works long enough will likely learn many.

What about HTML? Apps?

The most direct way of practicing writing problems for a computer to solve, and getting their answer back, is working in plain text.

HTML is a great way of making websites, but on its own it won’t let you pose other problems to the computer, or to get its answers back. HTML and Javascript, together, are as powerful as any other language; but they’re more complicated than working on text alone.

Mobile apps - whether on iPhone, Android, or elsewhere - similarly spend a lot of effort on things that are not about asking questions of the computer or getting its answer back.

Even the best professional programmer can get confused if they try working on too many layers of a problem at once. You’ll likely do better if you start learning only a single layer at the start, rather than two or three.

What materials should I use?

If you’re in a course, use what the course is using. If you’re choosing on your own:

  • For Python, I like what I’ve seen of Learn Python the Hard Way; it’s the closest I’ve seen to the workbooks that worked for me when I learned.

  • For Ruby, I liked Learn to Program when I looked last. But that was some time ago.

Whatever you choose, do the exercises. I don’t know anyone who learned to program without doing a significant amount of typing.

Should I send you programming questions?

No.

Programming questions take a good amount of work to answer even when they are simple to ask; enough work that you shouldn’t assume someone will be able to answer.

If you’re in a course, remember your instructor, especially if they have a designated help session each week. Or, in an on-campus program, go to the computer science lab and ask a TA.

You can often ask the same programmer friends you talked with earlier for help. Talking with them about learning to program can be a good time to learn about their openness to helping, too.

Lastly, join Stack Overflow. It’s a free community for programming questions and answers, and although there is no guarantee of help it works wonderfully often.