This is a response to a friend, Nate Dern, a smart guy who wants to learn to program but doesn’t know where to start. Spoiler alert: I rant for a while and then briefly answer his question at the very end.
Here’s what worked for me: I was born in 1980 to parents who were successful enough to afford a home computer and also easygoing enough to let their children play with it. The timing was fortuitous because it meant I had plenty of time to learn and — I think this is key — computers of the late 80s/early 90s were easier to learn about. Since then all I’ve had to do is keep up.
In other words, what worked for me definitely won’t work for you.
First of all, you should know that programming is not the same as computer science. It’s like the difference between doing math and being a mathematician. Or between gardening and being a plant biologist. I already knew how to program long before I got to college. Most students who enter C.S. programs do, in fact, which is why college programming classes are usually terrible. Don’t bother taking a class, unless you know someone who can vouch for it.
Second, you should distinguish programming (the skill) from learning a specific programming language, like Java or C++ or MATLAB. Different languages are suited for different tasks, but regardless of your ultimate goal, your first task is to learn programming. For example, if you want to write an iPhone app, you must learn Objective-C, but if you know nothing about programming, it’s a terrible place to start.
The first computers I ever used had a built-in BASIC interpreter, and if you were a geek (which you were, because you had a computer in your home in 1989) you would buy magazines with program listings in the back and type them in. Even if you didn’t want to learn how to write programs, you could not help but be exposed to the process.
Since then, computers have become consumer products that do all sorts of useful things out of the box, no programming required. Also, graphical interfaces have completely replaced text-based command lines. That’s great news, unless you’re learning to program, because programming for a graphical user interface is hard.
When you write for a text-based system, your program starts executing at the top, and continues line by line, until it gets to the end. This is relatively easy for a beginner to understand. When you write for a graphical system (desktop or web), your program is responding to events, and different functions are called in response to user actions. Writing programs for an event-based environment is a lot more complicated.
Why am I telling you this? Well, a lot of tutorials ignore or try to gloss over this difference. They believe you will be more excited to draw circles on the screen than to print text in a terminal, so they drop you in the event-based world without a good explanation of what is going on, telling you stick your code here and not worry about the rest of it. But the minute you start experimenting your program locks up and you don’t know why. A good tutorial will teach you programming skills in a text-based environment.
OK, so those are some of my opinions on learning to program, from the perspective of someone who likes to write programs. But you aren’t specifically interested in becoming a programmer, you just want to learn enough to mine data from websites. So, if I haven’t scared you off, let’s talk about your specific case:
The good news is that you won’t need to learn any of that event-based graphical user interface stuff. And not in you-can-cut-corners way, but in a that-won’t-be-useful-for-the-task way.
Second, you will want a language that can deal with text easily, since you will eventually be downloading web pages and then parsing out the bits you are interested in.
Anything in the category of “scripting language” would fit the bill, and those are a good choice for learning general programming concepts, too. The big ones in that category are Python, Perl, and Ruby.
My advice: find a book that teaches programming using one of those languages. Preferably, a “Learn How to Program” book that happens to use one of them, as opposed to a “Learn Python/Perl/Ruby” book that claims to assume no prior knowledge is necessary.
I can’t recommend a specific book. Search Amazon and read the reviews or go to a bookstore and browse through the books. Even better: go to a bookstore and look up the Amazon reviews on your smartphone as you browse.
Once you pick a book, treat it like a college textbook and work through it. Do all the exercises. (Oh yeah, pick a book with exercises.) Wander off course and experiment on your own if you’re feeling bold, but if you get lost or stuck, go back to the book.
Oh, and sign up for an account at Stack Overflow. It’s a Q&A site for programmers. If you have a question, you can search there to see if it’s been answered, and if it hasn’t, you can ask it. (I’m happy to help, too, but I guarantee Stack Overflow will get you answers faster.)
Good luck! Let me know how it goes.