

Want to learn to code? Start here. - kine
http://blog.zackshapiro.com/want-to-learn-to-code-start-here

======
justjimmy
So I set up a VPS for the first time this week, here's how it went:

1\. Shell? SSH? Wtf is this? Console? Huh? Why am I using something that looks
like DOS, it's 2013! Where is the GUI and menus?!

So I learned about Shell/SSH, connected to my server, root and all that stuff.

2\. Navigating folders and directories - dear god, this was a nightmare. I
never used 'cd \' since '98 and that's only cause I wanted to run DOS games.

3\. Kept seeing all these commands with '-' that makes installing extensions
seem oh so easy! I wanted APC for PHP, stared at this page
(<http://pecl.php.net/package/APC>) for an hour, trying to figure out what to
do. Googled like mad. Searching for _anything_.

Learned about "pecl install APC", nope no luck. Then I was told to compile it
from source. Yeah, I know _exactly_ what that means! Spent the next 4 hours
trying to understand why phpize wouldn't work!

Oh, I wasn't doing it from the right directory. -_-

I mean, I'm slowly beginning to see how it all fits together but none of the
education sites teaches you this stuff!

It's like learning cooking recipes when you don't know how to turn the stove
on, or what a stove even looks like. Or what's the difference between gas and
electricity stove, how to turn on the tap to get water, etc. You learn a great
recipe, know all the ingredients and the cooking time down to the second, but
when it comes to use the tools and actually cook? Nope - cause I don't know
how to turn on the stove or know what a stove looks like! (I know this is an
extreme analogy)

I wish tutorials would start with projects and setting it up from scratch. If
you're going to show me how to do something localhost, you have to show me how
to do it on a server (and set up) as well or else I'll never be able to make
that connection. (Well not never, but makes it harder)

Oh, editing files in the terminal is a blast too :P
<http://amath.colorado.edu/computing/unix/vi/> This saved my life that day.

So…I definitely vote for teaching the environment before programming.

PS: I did eventually install APC…after an entire day :P Now I'm trying to find
and learn about setting up master/staging/production (and what it all means).

Edit: Just to give some context of why I needed VPS - I wanted root access so
I can make a wiki have clean URL (rewrite) and figured why not, learn about
VPS. Then that's where I realized I need to learn 10 other things to do this
one single thing. The APC was a suggested caching option to improve the site,
and trying to do that also needed me to learn more stuff. So it's all kind of
ties together when you're trying to accomplish a (seemingly) tiny thing.

~~~
bpatrianakos
I half disagree. If you want to learn to be a sysadmin then learn to be a
sysadmin. If you want to learn to code you learn to code. People who want to
learn to code want to know what to type that'll get the computer to spit out
whatever it is they want it to spit out. Mixing in environment stuff like you
describe is just going to complicate things and turn people off entirely.

Furthermore, most operating systems already have enough of the basics
installed that you're able to get up and running with simple programming
pretty quickly anyway. Learning to develop locally and deploying to a live
server are very different. Yeah, both run just about identical software but
the process is different. Locally, someone who's learning will install MAMP or
xampp or something or copy and paste a line of code to get homebrew or rvm on
their machine. There's a 50/50 mix of comfortable clicking around the GUI and
typing in the terminal. If you're just learning and go right to the vps I
think you're jumping the gun. The system may be the same but it takes some
experience before you realize that what you were comfortable with when
clicking around is almost the same thing you're doing in the vps over ssh
except you have to know which command to run rather than clicking "install".

Beginner books always have a section dedicated to setting up your environment
and sometimes take you all the way through deployment. Articles online don't
necessarily need that as they mostly assume you'll find that information
elsewhere and only concern themselves with the task at hand - coding.

Beyond all that I think that your frustrations are something you'll be
grateful for in the future when you do get it. I knew how to code before I
knew how to run a server. If I had learned the server stuff first and didn't
quit then I wouldn't have understood why I was doing these things and I
wouldn't have the knowledge of how everything from the language I was using to
the server to the OS all worked together which is invaluable. If I were
blindly following instructions on how to set up a lamp stack I wouldn't know
that hey I don't need these apache modules or oh I can disable this ini
setting, etc.

On one level I get your gas stove/kitchen tools analogy. But as someone who
understands these things now, on another level I don't think it fits. These
topics are so incredibly broad and complex that it makes sense not to lump
them together. Besides, there are plenty of places where you can just plop
your code and have it run from shared hosting to PAAS's like Heroku and such.

In the end its like the article says - these challenges are what'll teach you.
I don't know any good programmers that simply memorized how to do things
without having to earn the knowledge of how something works through tons of
failure.

~~~
mattmanser
_Furthermore, most operating systems already have enough of the basics
installed_

Maybe most operating systems do, but most laptops and PCs don't. Like 92% of
laptops and PCs. Which makes your comment seem divorced from reality.

Worse still a lot of programming guides assume you have a linux variant which
is so far from reality it's painful to watch. Though it's got a lot better
recently as the ruby/python package managers are a lot easier to install on
windows now.

A year or so back I was having a discussion with another HN user who was
running free Python programming workshops. He actually ended up specifying no
windows because it took so long to get everything working on them.

I suspect the more novice a programmer, less likely they are to have a Mac.
You will only have a mac if you're rich, a programmer or your parents are
rich. It's not an entry level OS. Let's not even pretend about linux.

------
austenallred
As a marketer who has been trying for some time now (I'm too embarrassed to
admit how long) to learn how to code, I've heard this advice _a lot_. Here is
my issue with it.

Everyone says, "Just pick something you want to build, and learn how to build
it." I don't know what I _want_ to build, because I don't know what I _can_
build. That's like taking someone who says "I want to learn calculus" and
saying "Well just think of a problem you want to solve."

~~~
derekp7
For beginning programs, there are two classifications that I remember being
taught way back when. First, there were the class of problems that can be
summed up by "Write a program to generate a sequence of Fibonacci numbers".
These were all algorithmic / somewhat math based problems. They usually came
from classes that were sponsored by the Engineering side of the school. The
second classification can be summed up by "You have two files, each containing
a list of [data items]. Produce a program that generates a third list of [data
items] [having a given characteristic]". These seamed to me to be more
practical / instructive.

So as a marketing person, think of some types of reports you would like to see
given some data that you have. Remember that the input data should consist of
a number of items (records or lines) that have consistent characteristics,
somewhat like you would get from a spreadsheet. Maybe you want to get a list
of how many customers from each zip code bought a blue widget vs. a green
widget. So in this case you would write down a mock up of what your resulting
report would look like, then figure out what manual steps you would do to get
there.

When going through this exercise manually, pretend that you can't remember
anything but your current thought, and that you have to write down everything
else. Each thing you write down on paper translates to a program variable.
Then, every time you have to change what is written down, make sure that is
done via a repeatable list of steps. That then translates into an algorithm,
which directly translates into lines of code.

Most of the first programs I had to do in "the real world" consisted of simply
taking data from multiple sources, and making reports that others in the
business could analyze. In some cases it was simple compound interest reports
based on employee deposits/withdraws in a company savings account (kind of
like an in-house mini credit union). Other times it was something like an
Inventory Turns report for our head of purchasing (a report of how many times
each product would completely cycle in inventory in a given month). These were
all done on a Unix command line, using a combination of shell scripts, sort,
join, uniq, and awk (this was well before perl came out). Eventually this type
of work became second nature (so i didn't have to think through the logic),
and I was able to move on to more advanced programming.

~~~
austenallred
Thank you! That is great advice.

------
cuppy
I'm one of those people who have been trying to learn how to code, and I did
start out using Codecademy. I quickly figured out what you're saying here: it
kind of sucks. It was helpful for making me think about things with a
programmer mindset and also helped teach me syntax, but I completed the entire
JavaScript and Python tracks without any clue how to go on to make my own
project. Also, it had so many bugs that half the time I ended up checking the
Q&A section and just copy/pasting code that worked.

On the contrary, I'm now doing One Month Rails, a $20 course from Skillshare.
The very first lesson taught me how to set up Git, get Ruby & Rails all set up
on my machine, created a new project, and deployed it to Heroku. This was
already a world more helpful than the Codecademy lessons. (I'm blogging about
it here in case anyone is interested: <https://cuppycode.wordpress.com/> )

Next I'm going to go through the Rails 3 Tutorial. If there are things like
this (project focused, help you set up the dev environment) for Python, could
anyone recommend?

~~~
sgpl
Rails Tutorial (<http://ruby.railstutorial.org/ruby-on-rails-tutorial-book>)
teaches you to do all those things and more. More importantly it is absolutely
free. I'm just pointing it out as I wasn't sure whether you were referring to
another book when you mentioned "Rails 3 Tutorial" as your next step.

For starting python I've seen <http://learnpythonthehardway.org/> recommended
a lot on here. It is also free online.

------
aviswanathan
As someone who went from design (Photoshop) to frontend (HTML, CSS, JS) to
backend (Ruby), I can totally vouch for ditching the 'one-stop-shop' sites
that claim to be able to teach you everything about programming. In my
experience, the most important thing to do is fork, break, and fix. Only if
you immerse yourself in programming are you able to understand and start
applying the concepts.

Also, I think a huge skill for any programmer is being able to search and find
answers quickly and efficiently. It sounds silly, but being able to quickly
Google search for a particular answer or abstract a StackOverflow question to
apply to your situation is huge when getting started because those are the
resources you come to use all the time when you're actually building a
product.

Just my $0.02.

~~~
sc0rb
Can we stop talking about Ruby programmers as if they are equal to people
doing real programming?

------
hkmurakami
_> 1) Nights, weekends are bad_

Not sure how I feel about (1) since that's the maximum most people can afford
to put in (they have to pay rent, etc) and I'm ambivalent about telling them
"your max effort isn't enough. You have to go all in". I agree with the
premise but I'm really not sure how practical it is in practice.

That being said, love the rest of the post.

~~~
kine
I understand what you're saying. I guess it's better to tell people to try and
put themselves in a place where they can code full time. For me it was an
internship, for others it may be a trial week or month in a different part of
their current job

~~~
nikomen
What about someone who has a job where they code full-time (or close to it)
but they don't enjoy what they're coding or they don't feel like they're
getting better in their current position? Sometimes you're not in a position
where you can leave at the moment and find a better coding position or you're
not yet good enough at coding to get a job where you actually learn. It's
incredibly hard to code for 30-40 hours a week and then try to do it for 5-10
hours a week extra after work to get better.

I'm worn out after 40 hours of work, so creating my own projects and/or
working on open source projects is difficult. However, without doing that, I
don't feel that I can move on to a more challenging development position
because I have no code I can show.

~~~
zampano
I totally understand the feeling. I'm currently in a low pay full time coding
job without benefits. I'm in no financial situation to consider quitting (I
wouldn't last a month). Only doing what I do at work advances my skillset
little, so I've been forced to do extra on nights and weekends. It is never
easy to coerce yourself into working extra but I've found a couple of tactics
that have helped immensely.

1\. Do it for money. I find working for someone else motivates me pretty well.
I wanted to learn how to use JS frameworks like ember or angular so I've done
a couple of simple restaurant menu CMS systems for local businesses. I did
them for peanuts on the condition that I didn't have hard deadlines. Even
though I have the luxury of taking as much time as I feel like, I feel some
obligation to anyone paying me for work. I've also found that it effectively
narrows the focus of the work in a way that might be more challenging in a
more free form project. It's a lot harder for me to not start including "cool"
but often-useless features in my own projects while I tend to keep my work for
others limited to what was agreed upon originally.

2\. My other method is to set myself up with two or three productive
activities and force myself to rotate between them. I might choose learning
German vocabulary, refreshing math online and writing a simple app in a new
language for a night and make an effort to always be doing one of those tasks.
I try to look at this time as relaxation and free time itself, so I try to set
few expectations. When I get bored/frustrated, instead of turning on the TV or
opening the news, I switch to the next activity and repeat until its time for
bed. You can move forward on unrelated hobbies this way, something that
frustrated me when I first learned how to code and overdid the focus and
attention I gave it, to the point of severe frustration.

Lastly, try to relax and take it easy. If you put yourself through Hell every
night you'll quit and get nowhere. Take nights off when needed and get to bed
at a decent hour. You won't see immediate returns so any strategy has to be
looking toward the long haul.

------
darrellsilver
"Have a real project you want to build" and "You have to throw yourself in or
you will fail." are spot on.

At Thinkful (<http://thinkful.com/>) our students spend more than half their
time on projects they start from scratch, using real tools for exactly this
reason. As a result they have 10x the engagement and completion rates vs other
online ed tools (MOOCs et al).

Failing is learning, but failing is tough. We make that easier.

------
rachelbythebay
I've been working on something which lets people follow along at their own
pace and see exactly what goes into building a project. It involves a fair
amount of just plinking away at a text editor and then compiling it and giving
things a test run.

I set it up to show my sessions including any little lags, typos, or whatever
else I might make along the way. The idea is to show how a real person works
at this stuff, and to encourage other people to give it a spin at their
leisure. To that end, I have a pause button, variable speed playback, buttons
for jumping forward and backward, and of course unlimited restarts. All of
this happens in the browser, and it's just text, not video, so it's pretty
quick.

I use my own favorite text editor and build tool, but anyone so inclined can
certainly use their own favorites and it will work out just the same. I try to
twiddle a few things here and there to show what sort of differences they make
in the end.

So far, people really seem to dig it.

~~~
shubb
It's intriguing to see how someone clearly very comfortable on unix works on
the terminal.

~~~
rachelbythebay
I'm actually holding back on some of the crazier bits so it doesn't seem to
fly by. I don't use the reverse-i-search thing early in a session, for
instance. This means I wind up typing out certain commands verbatim more often
than I would in real life. Now, once I've used something once or twice I'll
flip back in the history a line or two where appropriate, but that's about it.
In real life, I use things like ^U ^W and ^Y far more than I do in those
recordings.

Unfortunately, to truly capture how I normally work on things, I'd have to
have it grab multiple windows in parallel. I don't normally drop out of my
editor to run compilers. That's just something which happens for those
"lessons".

~~~
qu4z-2
These days I "drop out" of my editor with C-z to run compilers/system tools.
That way you don't lose your editor state, but you also get the full shell
(reverse-i search, etc) for whatever other tasks you're doing.

Just something that works for me; not sure if you've tried it. YMMV.

~~~
rachelbythebay
I suppose I could enable that while doing these recordings... or just use
screen. Or hey, maybe I'll figure out the parallel recording situation and
then it'll _really_ be just like watching over my shoulder.

------
mattangriffel
So my One Month Rails class is the biggest class on Skillshare at the moment
(5000 students) and I can't echo this point enough:

"Here's why Codecademy doesn't work in the long term... You don't know how to
set up a development environment. Any time you have the slightest inkling to
build something for yourself leveraging what you've learned in Codecademy, you
can't and probably don't know where to start."

I'm all for encouraging a solid understanding of the syntax of code, but it's
a totally different skill set from building web applications – which requires
an understanding of topics like MVC, authentication, authorization, deploying,
and using 3rd party libraries (and which to use).

This is the kind of stuff people want to learn when they talk about learning
how to code and most sites bait and switch them into learning loops,
variables, and functions.

------
evantahler
I can't for the life or me remember who said it, but:

"Learning to code is a try{}catch{}. Always be prepared to handle things going
to wrong, because they will. Every language has a try catch for a reason.
Try() is doing, Catch() is learning"

~~~
gizmo686
>Every language has a try catch for a reason.

You do realize that not every language has a try catch?

~~~
fosk
When in doubt: On Error Resume Next

------
drexel
I rolled my eyes when I read the title expecting another compendium of
codeacademy-like resources which get you started and then leave you out to
dry. I'm finally beginning to feel like I'm actually learning to code by doing
pretty much exactly what you described!

~~~
kine
I'm glad it was helpful. I'm as sick of those empty posts as you are :)

~~~
drexel
I should note that I was doing these things before I read the article but this
post helps to reassure me that I'm on the right track. I glanced at the
article about learning Rails and also found the RailsTutorial book to be a
great resource even for a beginner like myself given its "dive in and start
doing realistic projects" nature.

------
banachtarski
Totally agree on not having newbies learn to code in a browser. There are so
many intangible things that they need to learn to actually produce anything
meaningful aside from typing the code itself.

People I know who have tried codeacademy or something similar complain that
they are just typing "magical" words that produce effects on the screen.
Perhaps a way to remedy this is to have them actually download the source
files after a lesson is done or something so they can see what they've
actually created, outside of the course's blackbox framework.

------
viscanti
> 7) Coding is failing a ton and understanding why. It's painful and
> frustrating

I'd argue that an aspiring programmer's ability to deal with frustration is
probably the single biggest indicator of "success". Obviously it's an on-going
process, and you're always learning, but I'd say the biggest difference
between "trying to learn" and being able to do some basic programming is how
you deal with those initial frustrations. It's really easy to give up and go
do something you think you're better at.

------
woah
I am learning how to code, and one important thing that I have realized
recently is that it can be bad to focus on building specific projects too
much. I have spent a lot of time banging my head into the wall on specific
implementation problems that might have been spent more efficiently learning
from tutorials or books. Since I have started setting aside time for "pure
learning" I have gained the background knowledge in languages and libraries to
figure out how to solve problems that come up.

~~~
muraiki
Yeah, I did the same thing in that my first project was a bit overly
ambitious! I ended up getting discouraged because I would always pour my
programming time into this single project, but I simply didn't know enough in
order to design it properly.

I found that by setting it aside and working on something else, I gained new
perspectives as to how to approach the problems that I got stuck on with my
first project.

------
SeanAm
I would recommend Harvard's CS50 program. It is the most complete package I've
come across for beginners. Downloadable VM's with everything set up - video
lectures, problemsets, forum for questions and so on. And the good part is
that it isn't just one language - you are exposed to many of the building
blocks(C,HTML,SQL,Javascript++) of modern computing.

<https://www.edx.org/courses/HarvardX/CS50x/2012/>

------
Paul_D_Santana
I totally agree. I started with installing Eclipse, creating a new Android
project, adding a single button and... Just going from there.

I had no intention of publishing it to the official Google Play Store, but I
did, purely as a learning experience (and I sure learned a heck of a lot
because it's definitely not a straightforward process).

And I'm sure we all have experiences like that, right? You'll be amazed at
what you can do by just jumping in.

------
ataleb52
Thank you for the awesomeness you have infused your post with. I began on the
very road you've suggested not to take about a year, never got anywhere with
programming. Got a 9-5 after graduating then finally started doing what you've
suggested...

Quit my cube job, got a technical internship, and code practically every
breathing moment I'm not at work...friends and fun...what are those again? :P

------
steven2012
> Coding is failing a ton and understanding why. It's painful and frustrating

I get what he is saying but I disagree, in that I think that coding is
actually _succeeding_ to get something working by any means necessary, even if
you don't quite understand why. Be it getting your first web site up and
running, getting your first program compiled, fixing your first bug, etc.
There are a lot of hurdles and roadblocks you will face, especially when you
are starting out, it will seem that every single piece of information is just
out of your reach, like Tantalus and the grapes. It takes a lot of patience
and perseverance to get through most programming problems, but that feeling of
satisfaction of getting past these roadblocks is amazing. I still get that
feeling of satisfaction and accomplishment, even though I'm 20+ years into my
programming career.

The followup to that is that you look back at your code 6 months later,
cringe, and then rewrite it to something that is an order of magnitude better.

------
akristofcak
Nice article.

Zack, you say pick a language "Ruby or Python". I started out in PHP (I have
no recollection why) and while I'm far from perfect, I know it well enough to
build functioning things and more importantly to figure where to find answers
when I'm stuck.

Yet whenever I read other people's writing about coding, almost without fail
people say "PHP sucks, do Python" or "PHP sucks, learn Ruby".

Without getting into the arguments about which language is better (I am fairly
aware of the differences), can people who have experience with all three opine
on whether it makes sense to throw out the time and energy I have invested in
PHP (not to mention lot of well functioning code) and start from scratch with
one of the other two?

~~~
sanderjd
Two answers for your one question: no, it absolutely doesn't make sense to
throw out the time and energy you have invested in PHP, but yes, it absolutely
does make sense to start from scratch with one of the other two. Both in fact,
and any others that you come across. The more the merrier! Programming
languages don't take up mutually exclusive niches in your brain, they
complement one another.

~~~
akristofcak
That's a great response - thanks!

------
jurassic
> Forget Codecademy

This. Getting everything installed and the environment configured is huge.

~~~
kine
This needs to be a service. It's such a huge fall off point for beginners

~~~
aviswanathan
Totally agree. One-click interface to spin up an environment.

~~~
spmurrayzzz
Maybe devtable[1] could be extended in a way thats a little more bent towards
code education.

[1] <http://try.devtable.com/>

------
mgshuheb
I am learning to develop in Ruby on Rails. Thanks Mattan Griffel from Grow
Hack who's also a teacher on SkillShare [dot] com. He has made a series of
'straight to the point' lectures guiding any person with any level of coding
to create a basic version of Pinterest by the use of RoR. The series is called
'One Month Rails' (<http://onemonthrails.com>). I have been using and I am
currently enrolled in his class on Skill Share. Personally I have browsed
through hundreds of website looking for learning material and these videos
have been the best for me so far!

------
jthree
If people are interested in learning Ruby, Rails, or JavaScript in a "real"
environment (running on your own machine, as a normal developer would), we
have both a Environment Setup Guide
([http://tutorials.jumpstartlab.com/topics/environment/environ...](http://tutorials.jumpstartlab.com/topics/environment/environment.html))
and dozens of tutorials from complete walk-throughs to open-ended projects at
<http://tutorials.jumpstartlab.com/> , all Creative Commons Non-Commercial.

~~~
hallbd16
Jeff, thanks for the links. It was the help I needed in getting past the
online based setups I have been using so far. Plus it was a pleasant surprise
to see the curriculum of g|school.

P.S. Glancing at your other posts, I really like what you and Steve have said
about g|school having high expectations for your students.

P.S.S- Look out for me in the applications, I am hoping to submit my
application the end of April.

-Brian Hall

------
catshirt
i have no formal experience in teaching, but given my own experience i'd have
to say that having a technical mentor who is close to you is the single most
important factor. important enough that it could probably stand alone (with
the proper ambition of course).

i'd like to see some sort of matching service that helps match potential
programmers with mentors, based on common interest. the "student" gets to
learn in a context relevant to their interests, and the mentor gets an extra
hand on their project.

~~~
kine
That'd be interesting. Might be a fun weekend project to build. Get both
people to apply, maybe add a 1m video portion? Match on language or age or
years of experience perhaps?

Sometimes when you're learning something you need some hand-holding. I think
it's a major weak point in the process of learning to code. Just googling for
answers isn't always the answer.

------
tomasien
Tommy Nicholas, cited in this article, here. Love this, disagree with the
"forget Codecademy" part. Codecademy is incredibly useful and I still use it
to learn things today, but it's really really important to understand what
it's teaching you and what it's not.

It walks you through the thought process of various things you do when you
write code and makes you actually write it, which is awesome. But that's where
it ends so you've got to take the leap from there and actually BUILD
something.

~~~
TreyS
I think Codecademy is great for people who already know how to code a little
bit. I can use Codecademy to learn HTML/CSS or about using APIs. However, I
think for a complete neophyte, a book like Learn Python the Hard Way is
significantly better. Someone HAS to walk you through setting up a programming
environment, running an interpreter or compiling, etc. It can be incredibly
frustrating and intimidating for first timers.

~~~
tomasien
My friend Daniel says the same thing, he started with Codecademy and moved to
Learn Python the Hard Way, and he definitely says they both had their merits
but Learn Python the Hard Way got him to actually being able to code.

However, LPTHW wouldn't have made sense to him if he hadn't already done CA,
so he liked having done them both.

------
bjoe_lewis
>forget codeacademy

That's a good phrase.

Though it does a great job mastering you in syntax and semantics, with which
you could solve trivial problems the world's never going to face, real
learning comes from setting up a dev environment in your machine, and diving
in. Learning from mistakes best apply in learning to code, more than any other
context.

------
grannyg00se
"8. Stop trying to figure out what you should do and just start."

I would say this last point is the most important one. And it also kind of
cripples most of the other points.

~~~
kine
I disagree that it cripples the other points. I just think that a lot of
people try to find all of the failure points before they start. You can't
start without having a bit of direction (I reference a book to use in my first
post) but don't think about where the road will end up, just get on the road.

------
Vlaix
HN gives me the impression that on a bi-daily basis there's someone, somewhere
(generally an American brogrammer with too much hair and weird glasses living
in the Valleyr or NY) who _WANTS_ that I want to learn to code.

Is that someone actually the exact same person (looks like it) ? Does he know
that code can be executed outside of a browser ?

