I’ve always liked computers, yet somehow I’ve never learned any programming. I never needed it for anything, and no one I knew ever talked about learning about it.
So it wasn’t on my radar. But at the start of 2010, I left law school, and stared a website about the LSAT. I sell explanations online. I had to learn a bit about websites and freelance work. Along the way, I stumbled upon a site called Hacker News. It’s run by an early stage startup investment group called Y Combinator. The site has a surprisingly high level of discussion, and great information about programming.
While working on my site, I could imagine all sorts of things that I’d like to do. And reading Hacker News made me realise that with the right knowledge, I could do those things.
I’ve always liked learning new skills, and I have no trouble learning on my own. So I decided that in 2012 I would teach myself to program.
I had tried in 2011. I fiddled around with various methods, but nothing stuck. I decided I needed some clear framework for how to learn. Luckily, I stumbled across this question on Stack Exchange:
Hey, that’a me! A bright person with no programming knowledge. The answer comes from Joel Spolsky, a prolific programming blogger. His team recently made a cool project management webapp called Trello. I use it to keep track of long range to-do lists. Check it out!
Joel says to work through three books:
3. The Structure And Interpretation of Computer Programs,by Harold Abelson and Gerald Sussman
Joel’s idea is to get a strong foundation. For a long time, before reading that post, I was stuck on which programming language to choose. But reading that post (and subsequent research) led me to realize that once you learn programming, you can learn a new language fairly quickly. It’s the mental concepts behind the abstract idea of programming that are the hard part. I looked into the books, and they seem like a good way to get that foundation.
I’m currently (January 2012) on the C Programming Language. But I’m also using some other books. This blog is going to be a diary of sorts, so below I will describe each book I’m using. Hopefully it will be useful for anyone else who wants to learn programming.
1. Code, by Charles Petzhold
This is an excellent introduction to the idea of a computer. Petzhold starts from simple circuits, and eventually builds a whole working computer. Petzhold teaches you to understand and apply binary logic, using simple logic gates. He builds these up into a larger computer.
It starts off easy, and gets harder. Make sure to actually work your way through the diagrams. It’s slower, but it’s the only way to really understand what’s going on.
As part of a learning curriculum, I’d say the book serves two purposes:
1. A litmus test. I loved the book. And most people who program love the book (check the amazon reviews). If you don’t like the material, that could be a strong sign that programming is not your thing. Better to find out early.
2. The book gave me a clearer understand of what exactly is going on within the computer when it’s running my code. I plan to read the book again to solidify my understanding.
2. D is for Digital
This is not strictly a programming book, though it briefly introduces the topic. Rather, it’s an easy to read and information survey of the whole world of computing. This book gave me a good idea of how everything fits together, and which topics I should be aware of.
Almost any programming tutorial starts with teaching you to build a simple programs that displays: “Hello, World”. Where did that idea come from? This book.
This book is famous for teaching good style and for it’s clear, concise style. It was written by Brian Kernighan (author of D for Digital, above) and Dennis Ritchie, who created C and Unix.
As of January 2012, I’m on the second chapter. The tutorial chapter took about three weeks, but that’s because I made sure I understood all the exercises. That chapter alone has taught me more than all the web programming tutorials I’ve tried, combined. You start right away with if-else statements, while and for loops, etc. So I’ve already learned a fair number of things to transform thoughts into a functional program.
As a supplement, I highly recommend The C Answer Book.
That book has (good) answer for each exercise. There were times when I was quite stuck. The biggest risk of working alone is succumbing to frustration while stuck on a problem.
This book prevents that by offering a way out. I try to use it as little as possible of course, until I have a working solution. But even if I do solve an exercise on my own, it’s quite useful to look at another sample of code that achieves the same goal.
This book has a simple goal: teach you to think recursively. It uses a simplified version of scheme, and a question and answer format. It is shocking at first. The very first question is:
“Is this an atom?
You then learn what an atom is by seeing several examples. The book teaches you basic lisp concepts using the same method, such as car (first part of a list) and cdr (the rest of a list).
I’m on chapter seven out of ten; the book has been a consistently fun read. I can actually feel it changing the way I think. My advice is to do answer the questions using pen and paper; no computer required. (The book only has value if you do answer the questions).
I’ve also bought the sequel, The Seasoned Schemer. These books won’t teach you how to write a working program, but they do teach concepts that will help you learn how to do that. From the conclusion of the seasoned schemer(paraphrased):
“To program, you need to understand the nature of computation, and the features of a specific language. The first of these is the more difficult intellectual task. If you’ve read these two books, you’ve mastered that challenge.”
Sounds pretty compelling to me.
There’s a third book in the series, the Reasoned Schemer. I may get it, since these books are highly useful and don’t take very long to go through. But it covers something else, logic programming.
For years, this was the textbook for the introductory computer science course at MIT. It’s legendary among skilled programmers. It’s not going to be easy, but I should be able to get through it – it was intended for undergrads, after all.
I don’t have much to say about it, because I’m doing it last started it. But it promises to be excellent.
There are video lectures available to accompany the course.
The book also has a website, with much useful information:
Finally, this MIT Opencourseware page has some notes related to the book and course:
In Canada, it cost me about $250-300 to buy these books. I think it will be well worth it. I’ll be posting updates about how the learning is going. Meanwhile, having all of the books on hand is a big motivator not to abandon the project.