how to teach yourself to code

138
How to Teach Yourself to Code .

Upload: mattan-griffel

Post on 26-Aug-2014

138.517 views

Category:

Self Improvement


4 download

DESCRIPTION

A talk I did at Angelhack SF on May 4, 2013 (Updated).

TRANSCRIPT

Page 1: How to Teach Yourself to Code

How to Teach Yourself to Code.

Page 2: How to Teach Yourself to Code

Part 1:Stop Waiting for the Perfect Technical Co-Founder and Start Learning How to Code

Page 3: How to Teach Yourself to Code

Why learn how to code?

Page 4: How to Teach Yourself to Code

A lot of you just have

an idea

Page 5: How to Teach Yourself to Code

If you’re expecting to find someone to build that idea for you, it’s never going to happen

Page 6: How to Teach Yourself to Code

Demand for developers has

skyrocketed

Page 7: How to Teach Yourself to Code

Think about it…

Page 8: How to Teach Yourself to Code

Anyone with any programming talent is getting offers from

Facebook, Google and dozens of other startups right now

Page 9: How to Teach Yourself to Code

Why should a programmer choose your idea over any other?

Page 10: How to Teach Yourself to Code

Do you want to pay someone?

Page 11: How to Teach Yourself to Code

1) You will pay too much

Page 12: How to Teach Yourself to Code

1) You will pay too much2) You’ll be unhappy with the process

Page 13: How to Teach Yourself to Code

1) You will pay too much2) You’ll be unhappy with the process3) You’ll get something back you didn’t want

Page 14: How to Teach Yourself to Code

WHY?

Page 15: How to Teach Yourself to Code

WHY?Software is hard to estimate

Page 16: How to Teach Yourself to Code

WHY?Software is hard to estimate

“Should this really take 15 hours, or am I getting ripped off?”

Page 17: How to Teach Yourself to Code

If you’re an entrepreneur waiting for someone to execute your idea for you,

you’re not an entrepreneur

Page 18: How to Teach Yourself to Code

(sorry)

If you’re an entrepreneur waiting for someone to execute your idea for you,

you’re not an entrepreneur

Page 19: How to Teach Yourself to Code

“Pre-Dodgeball I went through 3-4 years thinking I was going to meet some magical engineer who would build all the stuff I was thinking about. But I never met that person, so I taught myself ASP and MS Access out of a book and got to work just hacking stuff together. I’m still a really shitty programmer but I know enough to hack a prototype together.”

- Dennis Crowley, Foursquare

Page 20: How to Teach Yourself to Code

Learning how to code≠

How to be a software engineer

Page 21: How to Teach Yourself to Code

The point is for you to learn to

code well enough to build a prototype

Page 22: How to Teach Yourself to Code

(aka Minimum Viable Product)

The point is for you to learn to

code well enough to build a prototype

Page 23: How to Teach Yourself to Code

MVP = quick + dirty

Page 24: How to Teach Yourself to Code

“Product with the fewest number of features needed to achieve a specific objective.”

– The Entrepreneurs Guide to Customer Development

Page 25: How to Teach Yourself to Code

Side note: build products that are valuable despite being ugly

Page 26: How to Teach Yourself to Code
Page 27: How to Teach Yourself to Code

Eventually you’ll need to find a lead developer

Page 28: How to Teach Yourself to Code

Knowing how to code helps you find, pitch and manage good

developers

Page 29: How to Teach Yourself to Code

More and more, the things we interact with in the world

around us qualifies as

“technology”

Page 30: How to Teach Yourself to Code

There are 10 kinds of people:

Page 31: How to Teach Yourself to Code

There are 10 kinds of people:

Those who understand binary and those who don’t

Page 32: How to Teach Yourself to Code

Society is quickly dividing into two groups:

1)Those that know how to code –they can manipulate the very structure of the world around them.

If you’re interested in learning more, read Program or Be Programmed: http://amzn.to/yzd6hm

2)Those that don’t – their lives are being designed and directed by those that do.

Page 33: How to Teach Yourself to Code

Part 2:Choosing a Programming Language

Page 34: How to Teach Yourself to Code

I get it,it’s scary to

jump in.

Page 35: How to Teach Yourself to Code

C, Java, C++, PHP, JavaScript, Python, C#, Perl, SQL, Ruby, Shell, Visual Basic, Assembly, Actionscr ipt, Objective C, Lisp, Where do you start? Delphi, Pascal, Scheme, Haskell, Tcl, Backbone, Fortran, Ada, Lua, ColdFusion, Cobol, Erlang, D, Scala, Smalltalk, Ocaml, Forth, Rexx,

Page 36: How to Teach Yourself to Code

Breaking down a web application

Page 37: How to Teach Yourself to Code

Web applications are applications accessed over the internet

Page 38: How to Teach Yourself to Code

(which are different from mobile applications)

Page 39: How to Teach Yourself to Code

Every web application has a front-end and a back-end

Page 40: How to Teach Yourself to Code

The front-end is what you see

Front-end languages:• HTML• CSS• JavaScript

Web Pages

Page 41: How to Teach Yourself to Code

<h1>Welcome to Twitter.</h1><p>Find out what’s happening, right now, with the people and organizations you care about.</p>

Page 42: How to Teach Yourself to Code

<h1>Welcome to Twitter.</h1><p>Find out what’s happening, right now, with the people and organizations you care about.</p>

This is HTML

Page 43: How to Teach Yourself to Code

The back-end is what you don’t see

DatabaseWeb Pages Rules

Programming languages:PHP, Ruby, Python, Java

Database languages:SQL

Page 44: How to Teach Yourself to Code

echo “Hello World”; print(‘Hello World’) puts “Hello World”

They’re all the same, just different

PHP Python Ruby

Hello World Hello World Hello World

Page 45: How to Teach Yourself to Code

And then there are web application frameworks

DatabaseWeb Pages Rules

Web application frameworks: Ruby on Rails, Django

Page 46: How to Teach Yourself to Code

“alleviate overhead associated with web development by providing libraries for database access, templating frameworks, and session management. Blah blah blah blah blah blah blah.”

Web application frameworks

Page 47: How to Teach Yourself to Code

“alleviate overhead associated with web development by providing libraries for database access, templating frameworks, and session management. Blah blah blah blah blah blah blah.”

Web application frameworks

build web apps really quickly

Page 48: How to Teach Yourself to Code

If your goal is to build a prototype, start withRuby on Rails(aka ‘Rails’)

Page 49: How to Teach Yourself to Code

Ruby on Rails is a web application framework

for Ruby

Page 50: How to Teach Yourself to Code

Rails is the easiest to dive into

Page 51: How to Teach Yourself to Code

Rails is the easiest to dive into (tons of resources and a huge community)

Page 52: How to Teach Yourself to Code

Ruby (and therefore Rails) is easier to understand

Page 53: How to Teach Yourself to Code

exit unless "restaurant".include? "aura"

Page 54: How to Teach Yourself to Code

['toast', 'cheese', 'wine'].each { |food| print food.capitalize }

Page 55: How to Teach Yourself to Code

['toast', 'cheese', 'wine'].each { |food| print food.capitalize }

(try saying it out loud)

Page 56: How to Teach Yourself to Code

Rails hides all the stuff you really don’t need to know

Page 57: How to Teach Yourself to Code

Rails is just shortcuts like this

rails new application

create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app create app/assets/images/rails.png create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/mailers create app/models create app/views/layouts/application.html.erb create app/mailers/.gitkeep create app/models/.gitkeep create config create config/routes.rb create config/application.rb create config/environment.rb . . . create vendor/plugins create vendor/plugins/.gitkeep run bundle install

Page 59: How to Teach Yourself to Code

There’s a temptation for programmers to say

“Start with PHP or Java”

Page 60: How to Teach Yourself to Code

They say this because:

1. it mirrors the way we learn things in school

2. it’s how they learned

Page 61: How to Teach Yourself to Code

IGNORE them

Page 62: How to Teach Yourself to Code

With those languages, you’ll spend MONTHS learning the basics so that you can do this:

Page 63: How to Teach Yourself to Code

(make a yellow square)

Page 64: How to Teach Yourself to Code

With Rails, fast and simple is the name of the game

Page 65: How to Teach Yourself to Code
Page 66: How to Teach Yourself to Code

The ability to get quick and positive feedback on your

projects is crucial

Page 67: How to Teach Yourself to Code

A final note: “Scaling” Rails

Page 68: How to Teach Yourself to Code

Does Rails scale?

Page 69: How to Teach Yourself to Code

Yes Some of the most heavily trafficked sites in the world use Rails

Basecamp Twitter Shopify Yellow Pages

GitHubLivingSocial GrouponSoundcloud Zendesk

Hulu

Page 70: How to Teach Yourself to Code

Part 3:How I Taught Myself to Code in One Month

Page 71: How to Teach Yourself to Code

I find traditional learning extremely tedious

Page 72: How to Teach Yourself to Code

So do you.(Otherwise you’d have learned how to code by now.)

Page 73: How to Teach Yourself to Code

So I developed my own methodI call “brute-force” learning

Page 74: How to Teach Yourself to Code

In college I would download podcasts of classes I was taking (from other schools)

Page 75: How to Teach Yourself to Code

Then I’d listen to the podcasts on the subway or walking

around the city.

Page 76: How to Teach Yourself to Code

Doing this ended up eliminating hundreds of hours of studying

(also teachers loved my “unique perspectives”)

Page 77: How to Teach Yourself to Code

Why does this work?

Page 78: How to Teach Yourself to Code

Have you ever been confused by something when it's explained one way but when it’s

explained a different way it just clicks?

Page 79: How to Teach Yourself to Code

The result is that learning is

less tedious

Page 80: How to Teach Yourself to Code

More importantly, the stress of feeling like you have to learn something the first time

disappears

Page 81: How to Teach Yourself to Code

It’s OKAY to not understand something the first time

Page 82: How to Teach Yourself to Code

It’s OKAY to not understand something the first time

Isn’t that sort of the point?

Page 83: How to Teach Yourself to Code

The first time you learn something, your mind creates a mental map. A fuzzy picture of all the pieces and

how they fit together.

Page 84: How to Teach Yourself to Code

When you go back, you relearn the specifics and it all starts to

make more sense

Page 85: How to Teach Yourself to Code

Just speed through as many introductory tutorials as possible

Page 86: How to Teach Yourself to Code

Here’s what I recommend:

Page 89: How to Teach Yourself to Code

When you finish, you’ll be able to build your own basic web app

Page 90: How to Teach Yourself to Code

But there will be specific features you don’t know how

to implement

Page 91: How to Teach Yourself to Code

Railscasts by Ryan Bates

Page 92: How to Teach Yourself to Code

At some point along the way, you may feel a temptation to STOP and

learn Ruby (or HTML or CSS)

Page 93: How to Teach Yourself to Code

At some point along the way, you may feel a temptation to STOP and

learn Ruby (or HTML or CSS)

Don’t.

Page 94: How to Teach Yourself to Code

Ruby Rails

Ruby is huge

Page 95: How to Teach Yourself to Code

Ruby Rails

Ruby is hugeAnd you only need to know a tiny bit of it

Page 96: How to Teach Yourself to Code

Besides, you’ll learn all the Ruby, HTML and CSS you need

to know along the way

Page 98: How to Teach Yourself to Code

Troubleshooting

Page 99: How to Teach Yourself to Code

75% of coding is Googling*

Page 100: How to Teach Yourself to Code

75% of coding is Googling**totally made up statistic

Page 102: How to Teach Yourself to Code

A lot of times you know what feature you want to build, but you

don’t know what it’s called

Page 103: How to Teach Yourself to Code

For example: Cron jobs let you schedule tasks in your app

Page 104: How to Teach Yourself to Code

Ask someone

Page 105: How to Teach Yourself to Code

Rails is very popular atthe moment and has a

LARGEcommunity for support

Page 106: How to Teach Yourself to Code

The best way to learn is to go to a Rails meetup and ask someone who

knows more than you

Page 107: How to Teach Yourself to Code

in NYC

• NYC.rb• NYC on Rails • New York Ruby Meetup • Ruby Nuby

Page 108: How to Teach Yourself to Code

Go attend some

hackathonsand find teams to work with

Page 109: How to Teach Yourself to Code

To hear about hackathons, sign up for the following mailing lists:• General Assembly• This Week in NYC Innovation• StartupDigest• Startup Weekend

Page 110: How to Teach Yourself to Code

The ∞ list of Rails includes:

• Rails for Zombies• Peepcode• Agile Web

Development with Rails

• Ruby on Rails Guides• Hackety-hack• Teamtreehouse• Code School

Page 111: How to Teach Yourself to Code

Part 4: Coding in a nutshell

Page 113: How to Teach Yourself to Code

This is your command center

Command Line Text Editor

Browser

Page 114: How to Teach Yourself to Code

The text editor is where you

write your code

Sublime Text

Page 115: How to Teach Yourself to Code

The command line is where you

run your code

Terminal

Page 116: How to Teach Yourself to Code

The browser is where you see

the result

Google Chrome

Page 117: How to Teach Yourself to Code

Rails uses a Model View Controller (MVC) architecture

Controller

View

Model

Database

Page 118: How to Teach Yourself to Code

DatabaseWeb Pages Rules

ControllerView Model

Rails uses a Model View Controller (MVC) architecture

Page 119: How to Teach Yourself to Code

Github is where you save versions of your project files

Page 120: How to Teach Yourself to Code

Heroku lets you deploy your app so that it’s live in seconds

Page 121: How to Teach Yourself to Code

Part 5: Let’s begin

Page 122: How to Teach Yourself to Code

1. Go to RailsInstaller.org

Page 123: How to Teach Yourself to Code

1. Go to RailsInstaller.org

2. Download the right installer

Page 124: How to Teach Yourself to Code

1. Go to RailsInstaller.org

2. Download the right installer

3. Follow the instructions

Page 125: How to Teach Yourself to Code

1. Go to RailsInstaller.org

2. Download the right installer

3. Follow the instructions

4. Yes do the Git thing too

Page 126: How to Teach Yourself to Code

Some people get this error:

Error changing group of /opt/rix to rvm

Page 127: How to Teach Yourself to Code

Some people get this error:

Error changing group of /opt/rix to rvm

Who can solve this first?!

Page 128: How to Teach Yourself to Code
Page 129: How to Teach Yourself to Code

Let’s check if it worked

Page 130: How to Teach Yourself to Code

Find your command line

Page 131: How to Teach Yourself to Code
Page 132: How to Teach Yourself to Code

Find your command line

Open Programs > RailsInstaller > Command Prompt with Ruby and Rails

Page 133: How to Teach Yourself to Code
Page 134: How to Teach Yourself to Code

Type this command and hit enter

rails -v

Page 135: How to Teach Yourself to Code

Type this command and hit enter

rails -vRails 3.2.13

If it says something like this, then it worked!

Page 136: How to Teach Yourself to Code

You’ve installed Rails, and you’re ready to create your first app