How do I learn to code? What language should I start with?

by Fuyang

Answer by Roshan Choxi on Quora:

It’s been my sole focus to answer this question for the last two years, and I think a lot of the resources mentioned here are great but I’ve noticed there are three strategies that successful students consistently use better than anyone else regardless of what resources they use:

1. Focus on habits, not goals
2. Learning alone is painful
3. Build things

Note: some of this is borrowed from my answer to another Quora question: How can I prepare for Bloc?

1. Focus on habits, not goals

It seems counterintuitive that you shouldn’t focus on goals, but hear me out — it’s all about leverage. Anyone who works with me knows that I dweebishly reference the R’as Al Ghul scene in Batman Begins pretty much 3-4 times a day:

Our investors at Bloc are getting tired of board meetings starting with Batman clips.

R’as tells Bruce:

“Rub your chest, your arms will take care of themselves.”

If you focus on building the habit of programming for 20-30 hours a week, you will reach your goal of being a web developer. If you focus on the goal of being a web developer in X months, you get nothing from that but stress and insecurity about how far along you are. Focus on the habit, not the goal. Rub your chest, your arms will take care of themselves.

So here’s what you should do right now: put 15 minutes a day on your calendar to spend time programming. Don’t do more than 15, just focus on doing 15 minutes a day. If you can do it successfully with no excuses for a week, try bumping it up to 20 minutes a day. Don’t try to overextend yourself by doing an hour a day right off the bat, this is going to be a 10,000 hour marathon so we’re focusing on developing the habit right now. The number of minutes you put in isn’t as important as you showing up each day.

2. Learning alone is painful

When I was learning web development, the two biggest social components to my learning were having a mentor and belonging to a community.

Having a mentor

I worked at a small startup called merge.fm while in college. I learned more in the summer I spent working with one of their cofounders than I did in the entire previous year at my university. There’s just something about working alongside an expert who knows more than you that really accelerates your learning, you’re able to pick up on how they think and unveil what you don’t know you don’t know. There’s a reason why mentorship used to be the de facto standard of learning a new trade, it’s very effective.

Belonging to a community

For me, the two communities I belonged to were the Illini Entrepreneurship Network (a student organization at my university) and HackerNews (a large hacker/startup oriented online community).

I didn’t learn what objects and classes were from HackerNews, but I learned a different category of things. I learned that nobody likes Javascript. I learned that Rubyists are the hipsters of programming. I learned that Bret Taylor, Rich Hickey, and John Carmack are programming gods, and that software companies that are truly serious about coffee have kitchens that look like meth labs.

In short, I learned how to talk shop. That turns out to be important when you’re working with other developers, but it’s also the thing that makes you feel like a developer.

3. Build things

In the first year of learning web development, I built:

  • A Digg Clone (from a Sitepoint book on Rails, I believe it’s out of date now though)
  • An E-Commerce App (from Agile Web Development with Rails 4)
  • A GeekSquad-esque App (personal project)
  • A Realtime, Online Classroom (personal project)
  • A Foreign Language Flashcard App (class project)

I think building real projects is important for many reasons, but the most important one to me is because it’s fun. That’s something that is tragically lost in classical education, but I think it’s important enough to be on this list. Look for resources that show you how to build things, http://ruby.railstutorial.org/ is a good one.

4. Be a cockroach

I secretly added a 4th item for those of you who’ve stuck around to read this far down the page.

Paul Graham once told the founders of Airbnb:

“You guys won’t die, you’re like cockroaches.”

You’ll probably want to quit learning how to code at some point. Like anything worthwhile, it’s difficult and will make you feel stupid at times. This is why #1 on this list is so important — stop worrying so much about whether you’re making progress or how much longer it’ll be until you feel like you’ve “made it.” All you have to do is focus on showing up, for 10-30 hours a week. Be as mindless as a cockroach about everything else, and don’t “die.”

I made the statement years ago which is often quoted that 80 percent of life is showing up. People used to always say to me that they wanted to write a play, they wanted to write a movie, they wanted to write a novel, and the couple of people that did it were 80 percent of the way to having something happen. All the other people struck out without ever getting that pack. They couldn’t do it, that’s why they don’t accomplish a thing, they don’t do the thing, so once you do it, if you actually write your film script, or write your novel, you are more than half way towards something good happening. So that I would say was say my biggest life lesson that has worked. All others have failed me.

Woody Allen

How do I learn to code? What language should I start with?