Basic programming

Created by: Roger Grosse, Colorado Reed
Intended for: beginners

(description of Metacademy)

But some topics are so important and fundamental that they appear all over the place. If you do any sort of programming, there are some basic concepts you'll simply have to be familiar with: control structures, functions, arrays, and so on. These are the air you breathe, the water you drink. Trying to list all the things that depend on them would be hopeless.

If you have already taken a university level programming course, or AP Computer Science, or have taught yourself enough programming to write simple programs (e.g. games), then you know enough to use Metacademy. You can skip the rest of this roadmap. If not, then read on.

What language to start with?

Really, you can start with any general-purpose programming language, such as Python, Ruby, Java, C, C++, C#, Go, Scala, JavaScript, etc. Most of the topics covered here will be similar enough in all of these languages that if you learn them in one language, you can quickly pick them up in any other.

All the languages I just listed are procedural programming languages, where statements are executed in order. At some universities, the introductory courses are taught in a functional programming language, such as Scheme or Haskell. You're free to follow this path as well, and being comfortable with functional programming ideas will pay off even in imperative programming languages. But be warned that this road can be more difficult, since the mapping between programs and algorithms is less obvious. Also, since functional and imperative languages are very different, it will be more work to translate what you've learned from one setting to the other. (Introductory college courses which use Scheme or Haskell are typically intended for students who have already done some programming in an imperative langauge.)

If you don't have a reason to want to learn a particular language, our recommendation is to start with Python. Here are some of the advantages:

  • The core language is clean and simple, and presents fewer hurdles to beginners compared with some of the alternatives
  • It is an interpreted language, so you can quickly experiment in an interactive shell
  • It is a very widely used language, with among the best software platforms for web development, data science, scientific computing, etc.

If you are impatient to get started, try one of the JavaScript tutorials listed below. The advantage is that JavaScript runs in all modern web browsers, which makes it easy for web sites to provide interactive exercises. You can start programming without having to install anything. The downside is that JavaScript has lots of gotchas which will bite you once you start writing programs of any significant size. On the balance, you'll probably save yourself time by starting with a language like Python.

Where to learn?

There are hundreds of textbooks, online courses, tutorials, and other kinds of introductions to programming out there. Any of them will probably cover all or most of the topics listed above. We list here a few free online resources which we happen to know about.

Option 1: online programming course

Do one of the following:

  • The EdX course CS50, Introduction to Computer Science, is Harvard's introductory programming course, aimed at non-majors. This has a light-hearted style, with high production values. The course covers several languages, but the relevant parts are taught in C. You should watch the videos for Weeks 0 through 3, and do problem sets 1 and 2.
  • 6.00sc, Introduction to Computer Science and Programming, is MIT's introductory computer science course, taught in Python. You should watch the lecture videos for Unit 1, which corresponds to about 1/3 of a semester course. Try the Unit 1 Quiz at the end.

Option 2: textbook

Here are some free online programming textbooks. Work your way through any one of them, doing the exercises as you go.

Option 3: JavaScript tutorial (for the impatient)

Do one of the following: