Thursday, May 15, 2008

Teach yourself you to Hack in 6-9 months

A.K.A. iamelgringo's opinionated and subjective syllabus for learning web programming/hacking

Every month or two, someone on Hacker News asks "How do I become a Hacker?" And, I'm happy to take a stab at the question. I had those questions myself at some point in time. Since it's Paul Graham's sandbox they're playing in, I'll assume that what they are really asking is how to make web applications. And, this post is my answer.

First off, much of the below, can be learned from web tutorials. But, a lot of times, a book is the only thing that will scratch the itch. So, before you bankrupt yourself at Barnes and Ignoble, I'd highly recommend getting a Safari subscription. There's a lot of great books out there on the below topics, and a Safari subscription is a cheap way to access a lot of them at once.

Learn what a text editor is, and why you need one You'll be using one for the rest of your hacking career. Word or Wordpad will not do. Try E or textpad on Windows, Textmate on Mac and Gedit or Kate on *nix to start. (time 1-2 days)

HTML. This will get you familiar with the concept of looking at code and HTML is the lego brick of the interweb, so learn it well, grasshopper. I'd suggest putting off CSS and javascript until later. (Time 2-4 weeks)

Learn some flavor of Unix command line. You're not going to get very far without being at least familiar with a command line and some basic Unix commands. Learning how to program can be discouraging at first because you don't realize how much work it is. You probably expect to be able to write a Word or Counterstrike clone in weeks. I did. Weaning yourself from a GUI and learning a command line is where the blue pill takes you. If you're married to a Windows box, your best bet is to download VMware player and a preconfigured virtual appliance with Ubutu on it. Bonus points for installing Linux from scratch on a spare computer. The more comfortable you are with a command line the better. Hacker:Unix == Capenter:hammer and saw. Nuff said.(Time 1-4 months)

Learn how to ssh into a remote Unix computer and run commands on it. You'll need this a lot later. Learn how to FTP files from one computer to another. (Time 1-2 weeks)

Python. Everybody has an opinion on what the best first language is, and they'll tell you all their arguments for them. Not being familiar with programming, none of that will make any sense to you. Save yourself a lot of worry and effort and just pick Python and run with it. Learning Python from the command line is a very nice introduction to an actual programming language. It's fairly easy to read, and there's a lot of good tutorials out there.

Focus on learning how to open, change and interact with text documents. HTML and web pages are all text. You'll need it. Bonus points for learning what Regular Expressions are. They are very painful, but occasionally they're the only thing that will do the job. (Time 2-4 months)

Client Server basics, Networking basics and the HTTP protocol. Read a couple of tutorials on each. (Time 1-2 weeks)

Apache -- learn what a web server is. Learn how to set one up, edit config files and serve web pages. You need this if you're going to write web apps. (Time 1 -2 weeks)

SQL and databases. Install MySQL and build basic databases from re-runnable SQL scripts. Learn database basics, what tables are, primary keys, foreign keys, data types, constraints. Again, it's painful, but this is what web frameworks are trying to save you from. It makes a lot more sense knowing what you're being saved from. (Time 1 month)

CGI programming with Python. This is the great grand-daddy of all web programming. It's painful, but it's what all the web frameworks are trying to save you from doing. You'll need to know what they're reacting against before the tutorials start to make sense. (Time 1-2 weeks)

Now, you can pick up Django and start messing around with it. All of the above will make Django much easier to learn. (Time 2-4 months)

CSS and Javascript to make your web sites pretty and fun. (Time 1-2 months)

Lather, Rinse, Repeat. (Time The rest of your life)

Did I miss anything? If so, let me know.

edit: There were some concerns on Hacker News about my devaluing the meaning of the word "hacker" which have some merit. If you want to learn how to be a hacker in the classic sense, start with Eric Raymond's guide. This post is primarily geared towards beginners who want to learn how to hack together web applications.

Labels: , ,