how to teach yourself to code
DESCRIPTION
A talk I did at Angelhack SF on May 4, 2013 (Updated).TRANSCRIPT
How to Teach Yourself to Code.
Part 1:Stop Waiting for the Perfect Technical Co-Founder and Start Learning How to Code
Why learn how to code?
A lot of you just have
an idea
If you’re expecting to find someone to build that idea for you, it’s never going to happen
Demand for developers has
skyrocketed
Think about it…
Anyone with any programming talent is getting offers from
Facebook, Google and dozens of other startups right now
Why should a programmer choose your idea over any other?
Do you want to pay someone?
1) You will pay too much
1) You will pay too much2) You’ll be unhappy with the process
1) You will pay too much2) You’ll be unhappy with the process3) You’ll get something back you didn’t want
WHY?
WHY?Software is hard to estimate
WHY?Software is hard to estimate
“Should this really take 15 hours, or am I getting ripped off?”
If you’re an entrepreneur waiting for someone to execute your idea for you,
you’re not an entrepreneur
(sorry)
If you’re an entrepreneur waiting for someone to execute your idea for you,
you’re not an entrepreneur
“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
Learning how to code≠
How to be a software engineer
The point is for you to learn to
code well enough to build a prototype
(aka Minimum Viable Product)
The point is for you to learn to
code well enough to build a prototype
MVP = quick + dirty
“Product with the fewest number of features needed to achieve a specific objective.”
– The Entrepreneurs Guide to Customer Development
Side note: build products that are valuable despite being ugly
Eventually you’ll need to find a lead developer
Knowing how to code helps you find, pitch and manage good
developers
More and more, the things we interact with in the world
around us qualifies as
“technology”
There are 10 kinds of people:
There are 10 kinds of people:
Those who understand binary and those who don’t
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.
Part 2:Choosing a Programming Language
I get it,it’s scary to
jump in.
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,
Breaking down a web application
Web applications are applications accessed over the internet
(which are different from mobile applications)
Every web application has a front-end and a back-end
The front-end is what you see
Front-end languages:• HTML• CSS• JavaScript
Web Pages
<h1>Welcome to Twitter.</h1><p>Find out what’s happening, right now, with the people and organizations you care about.</p>
<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
The back-end is what you don’t see
DatabaseWeb Pages Rules
Programming languages:PHP, Ruby, Python, Java
Database languages:SQL
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
And then there are web application frameworks
DatabaseWeb Pages Rules
Web application frameworks: Ruby on Rails, Django
“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
“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
If your goal is to build a prototype, start withRuby on Rails(aka ‘Rails’)
Ruby on Rails is a web application framework
for Ruby
Rails is the easiest to dive into
Rails is the easiest to dive into (tons of resources and a huge community)
Ruby (and therefore Rails) is easier to understand
exit unless "restaurant".include? "aura"
['toast', 'cheese', 'wine'].each { |food| print food.capitalize }
['toast', 'cheese', 'wine'].each { |food| print food.capitalize }
(try saying it out loud)
Rails hides all the stuff you really don’t need to know
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
So you can do stuff like this
There’s a temptation for programmers to say
“Start with PHP or Java”
They say this because:
1. it mirrors the way we learn things in school
2. it’s how they learned
IGNORE them
With those languages, you’ll spend MONTHS learning the basics so that you can do this:
(make a yellow square)
With Rails, fast and simple is the name of the game
The ability to get quick and positive feedback on your
projects is crucial
A final note: “Scaling” Rails
Does Rails scale?
Yes Some of the most heavily trafficked sites in the world use Rails
Basecamp Twitter Shopify Yellow Pages
GitHubLivingSocial GrouponSoundcloud Zendesk
Hulu
Part 3:How I Taught Myself to Code in One Month
I find traditional learning extremely tedious
So do you.(Otherwise you’d have learned how to code by now.)
So I developed my own methodI call “brute-force” learning
In college I would download podcasts of classes I was taking (from other schools)
Then I’d listen to the podcasts on the subway or walking
around the city.
Doing this ended up eliminating hundreds of hours of studying
(also teachers loved my “unique perspectives”)
Why does this work?
Have you ever been confused by something when it's explained one way but when it’s
explained a different way it just clicks?
The result is that learning is
less tedious
More importantly, the stress of feeling like you have to learn something the first time
disappears
It’s OKAY to not understand something the first time
It’s OKAY to not understand something the first time
Isn’t that sort of the point?
The first time you learn something, your mind creates a mental map. A fuzzy picture of all the pieces and
how they fit together.
When you go back, you relearn the specifics and it all starts to
make more sense
Just speed through as many introductory tutorials as possible
Here’s what I recommend:
One Month Railsby Mattan Griffel (Me!)
Ruby on Rails Tutorial by Michael Hartl
When you finish, you’ll be able to build your own basic web app
But there will be specific features you don’t know how
to implement
At some point along the way, you may feel a temptation to STOP and
learn Ruby (or HTML or CSS)
At some point along the way, you may feel a temptation to STOP and
learn Ruby (or HTML or CSS)
Don’t.
Ruby Rails
Ruby is huge
Ruby Rails
Ruby is hugeAnd you only need to know a tiny bit of it
Besides, you’ll learn all the Ruby, HTML and CSS you need
to know along the way
After you’ve finished, check out these fun resources that cover
basic Ruby:• Codecademy’s Ruby Track• Why’s (Poignant) Guide to Ruby• RubyMonk• RubyKoans• Learn Ruby the Hard Way• Ruby Warrior
Troubleshooting
75% of coding is Googling*
75% of coding is Googling**totally made up statistic
A lot of times you know what feature you want to build, but you
don’t know what it’s called
For example: Cron jobs let you schedule tasks in your app
Ask someone
Rails is very popular atthe moment and has a
LARGEcommunity for support
The best way to learn is to go to a Rails meetup and ask someone who
knows more than you
in NYC
• NYC.rb• NYC on Rails • New York Ruby Meetup • Ruby Nuby
Go attend some
hackathonsand find teams to work with
To hear about hackathons, sign up for the following mailing lists:• General Assembly• This Week in NYC Innovation• StartupDigest• Startup Weekend
The ∞ list of Rails includes:
• Rails for Zombies• Peepcode• Agile Web
Development with Rails
• Ruby on Rails Guides• Hackety-hack• Teamtreehouse• Code School
Part 4: Coding in a nutshell
Installing Rails issuper easy
This is your command center
Command Line Text Editor
Browser
The text editor is where you
write your code
Sublime Text
The command line is where you
run your code
Terminal
The browser is where you see
the result
Google Chrome
Rails uses a Model View Controller (MVC) architecture
Controller
View
Model
Database
DatabaseWeb Pages Rules
ControllerView Model
Rails uses a Model View Controller (MVC) architecture
Github is where you save versions of your project files
Heroku lets you deploy your app so that it’s live in seconds
Part 5: Let’s begin
1. Go to RailsInstaller.org
1. Go to RailsInstaller.org
2. Download the right installer
1. Go to RailsInstaller.org
2. Download the right installer
3. Follow the instructions
1. Go to RailsInstaller.org
2. Download the right installer
3. Follow the instructions
4. Yes do the Git thing too
Some people get this error:
Error changing group of /opt/rix to rvm
Some people get this error:
Error changing group of /opt/rix to rvm
Who can solve this first?!
Let’s check if it worked
Find your command line
Find your command line
Open Programs > RailsInstaller > Command Prompt with Ruby and Rails
Type this command and hit enter
rails -v
Type this command and hit enter
rails -vRails 3.2.13
If it says something like this, then it worked!
You’ve installed Rails, and you’re ready to create your first app
Go to onemonthrails.comto keep learning