How to learn programming
“I hated high school. It was the worst time of my life. [Then] college … was just awful. When you’re in high school, everyone tells you, ‘There’s a lot of repetitive bullshit and standardized tests; it’ll all be better once you’re in college.’ And then you get to your first year of college and they’re like, ‘Oh, no– it gets better when you’re in grad school.’ … I couldn’t take it. So I dropped out. And I’m glad I did.” – Jamie Zawinski (jwz), one of the world’s best programmers.
I’m often asked, “How can I learn programming?” It’s a very difficult question to answer. Usually, when people think of learning, they think of classes. I have never known this kind of learning to be very effective.
I didn’t like high school. Virtually all of the things that made high school bearable were actually outside of school. Computer Club, FBLA, the Walnut High School Solar Car Team– all well outside of classes. High school would’ve been better without classes. But that’s only for a person like me. I definitely do not think this would work in the general case, because I was far from a typical student. I never fit in anywhere in high school. The only place I fit in was outside, in the solar car team.
So I quit, and went to college early, skipping my senior year. For some students, senior year is a time of celebration and relaxation, but for me, it would’ve been torture. I’m very glad I left.
College, as jwz stated above, wasn’t actually tremendously better, when it comes to the classes. Sure, they were more advanced. Finally, people who actually cared about getting stuff done. But they were still mediocre when it came to actual learning. I was happy in college, partly because of my expectation that I should be happy there. If college didn’t work for me, there must be something wrong with me, I thought. College is everyone’s dream. I have no alternative. So in my mind, I made it work. My attitude made all the difference. I was always optimistic, cheerful, and looking for the best in all situations.
Now that college is done, I can look back on it more objectively. The people were great. It’s often said that college is worthwhile just for the people. That’s probably true. But when it comes to the classes, they were objectively pretty bad. It’s not a matter of being ‘easy’ or ‘hard’. It’s a matter of what they focus on, the way they’re structured, and what they actually do.
80% of the programming knowledge I picked up while in college, I learned on my own.
It doesn’t surprise me one bit that students are dropping out of computer science, or not going into it at all. College seems to make it hard to do. I don’t think it has to be that way. There are a few key things that have helped me learn how to program:
1) Motivation
People say they want to learn how to program, but they flake. They don’t stick with it. They lack an all-encompassing passion. My programming is extremely highly motivated, though for good reasons: it’s earning money, my code has been used by well over 5 million people, and it’s a creative outlet for me.
2) Focus
You cannot overstate the importance of focus. Sometimes people think that if they work on something for an hour, trying to figure out how something works, or why something is broken, or how to fix some bug — one hour — then they give up. They throw their hands up and say they’re done.
That’s ridiculous.
You need to concentrate, and put nearly unlimited amounts of focus behind your work. One hour doesn’t even scratch the surface. Two hours? Four? Eight? Sixteen? Now you’re talking. Why not spend 100 hours? (Literally. Wouldn’t phase me.) Of course, the time isn’t what you should be looking at. Time doesn’t actually matter. What’s important is what you’re getting done, what you’ve tried, where you’ve failed, and where you’re going. It’s not uncommon to hack away at the same problem all night. Programming requires real thought. It’s not like digging a ditch or farming some land, where you just put grunt work into it. You have to actually use creative mental energies, and that requires real focus.
3) Other people
When you’re stuck and not making progress, point #2 (Focus) does not mean wasting your time doing the same thing over and over again. You try something new. And you try it quickly. One of the places to turn (and fairly soon, actually) is other people. College is good for this, but thanks to the Internet, it’s not necessary. The other people I’ve turned to, who have helped me the most, are all online. And I haven’t met most of them in person yet.
Greg Smith of DevCybiko was an amazing help back when I was learning how to program the Cybiko handheld computer.
People in the iPhone development channels on IRC were invaluable when it came to developing Brain Tuner.
It is truly amazing how much of my progress can be credited to people I’ve chatted with online. Keep in mind we rarely talked about superficial things. We got right into the guts of the problem, tossing back and forth actual code. That’s what you need: concrete code-level collaboration.
4) Learning by doing
Lastly, there’s no substitute for actually doing. Too many people think they can learn programming by watching videos, or listening to lectures, or reading books, or talking to others. Compared to writing actual code and seeing what happens, nothing else matters.
Because you’re trying to program after all, aren’t you? Don’t be afraid of the computer. Don’t be afraid of errors or warnings. Confront them directly and immediately. Learn what every little detail means. Don’t miss a single pixel. Your compiler is throwing you 138,275 errors? You are not doing anything wrong. My code contains errors like that every day. That’s the computer helping you. Rely on it and get comfortable with it. Read the documentation, search on Google, and, sometimes, just sit back and think. Thinking is part of doing, too.
If you can really nail these 4, I think you’ll be well on your way.
Dropping out of college would put you in good company, with Bill Gates, Steve Jobs, Mark Zuckerberg, Jamie Zawinski, and so many other top techies. But ultimately, I’m glad I went. Not for the classes, but for the people I met there, and the connections it provided. If you already know the right people and have the right connections, college might not be necessary. But for me, college was actually incredibly good, if you don’t count the classes. Sure, I succeeded in classes, with a >3.8 GPA and all. But what I appreciated most are my internships at JPL and Google, the opportunity to be TA for the iPhone app development class for both semesters it was taught, and gaining friends who span the globe– which is why I’m in Viet Nam right now.
Whoa, you are really elite then. I’m planning to get into it starting out with PHP (I could do basic stuff :)) java and C in the future.
Not a bit deal, but just thought I would point out that farming isn’t just “grunt work.” Knowing how to grow and support life isn’t as easy as just planting seeds or feeding an animal
[…] Last night, I was asked how I learned computer programming. My answer: I learned by doing, at home on a computer. One might say I’m self-taught, but that’s not really true. I worked with lots of people, especially in my early days. I just never met any of those people in person. They are online friends. They’re real, physically located somewhere in the world; but not anywhere near me. For example, one of my teachers was Greg Smith, who I’ve mentioned before. […]