
How to begin to teach yourself how to code, starting from scratch - jrheard
http://jrheard.tumblr.com/post/421656059/you-yes-you-can-teach-yourself-how-to-program
======
Confusion
I really don't think you should advise someone to read "_why's poignant guide
to ruby" as an introductory text. The sillyness is very distracting, the humor
doesn't suit everyone, it's not very well structured and the information
density is quite low. I feel there's a ready chance it will be demotivating. I
definitely didn't consider it a decent introduction to Ruby or programming.
</heresy>

~~~
jrheard
Much as I love _why's works, you may have a point - I've been reading through
<http://pine.fm/LearnToProgram/> on the suggestion of a couple commenters on
the post, and I'm pretty impressed so far. I'm going to forward it along to
the friend whose question spawned the post.

------
adelevie
There needs to be more content geared to people who know nothing about
programming. Those people have the highest hurdles to jump, as they don't even
know what they don't know.

~~~
sumeeta
I couldn’t imagine jumping into programming (or even wanting to) without a
problem to solve first. That’s the whole point of programming, anyway. If
someone wants to learn programming, maybe we could help by directing them
towards a problem they’d find interesting.

~~~
jolie
What about those of us who are insatiably curious and love to learn for
learning's sake?

I'd find it more frustrating than anything to be confronted with a significant
problem right out of the gate.

~~~
sumeeta
I don’t think a problem has to be significant to be _useful_ to someone. I
just think it’d be ideal to work towards a product (no matter how trivial)
that the beginner could feel proud of and actually appreciate how it’s helping
them.

Learning programming “for learning’s sake” sounds great, but it also sounds
damn hard without goals.

~~~
aohtsab
that's been the most difficult part for me, actually -- finding fun problems
that I could work on that aren't completely impossible. I spent a lot of time
reading books on Python when I should have just been playing with code.

~~~
sumeeta
I learned programming by hacking on other people’s code – manipulating it to
fit my needs. Try to find an open source project you can mess with.

I can’t say for sure how much _fun_ this’ll be for you: The next time you
think to yourself, “I wish this thing worked like this” or “I wish this thing
had this feature”, if it’s open source, just load up the code and start
playing with it. Your problem might be easier to solve than you’d think.

------
Major_Grooves
I started a little blog about trying to learn to code from scratch:
<http://newbiehacker.wordpress.com/> As that blog post says, it is really
difficult finding resources for people who want to learn but really have _no_
programming background whatsoever.

~~~
jrheard
That's a great blog - it's really interesting to see what the code-o-sphere
looks like to a newcomer!

I saw that you were having a little trouble dealing with some of the proper-
noun Concepts thrown at you in Beginning Ruby, and that you weren't entirely
sure where to go next in terms of finding exercises not already in the book.

As far as the Concepts go, it's probably best to approach them all as a bunch
of different ways of solving the _one main problem in programming_ :
complexity[1]. When you're coding anything longer than ten lines, you're
usually tackling a problem that's too big to fit into your head all at once.
So, you need to break the problem into a bunch of little chunks. Coders do
this by building _abstractions_.

All an abstraction is is the act of deciding you've got a problem ("I need a
way to print the contents of the screen!"), solving that problem (by writing
code that grabs whatever's being output to the screen, translates it into
something the printer can deal with, and prints it), and then _hiding that
solution from anyone who has that problem_. The key here is that you're hiding
the solution, but you do expose an interface - a "print_document" function,
say - that allows them to benefit from your hard work without having to think
about it[2].

That's really what nearly every programming technique is all about: minimizing
complexity. So when you see big scary words like Encapsulation and
Polymorphism and Mix-Ins, just remember: they're almost certainly just
different ways of minimizing the amount of stuff you have to think about at
any point in time, and if they're any good at letting you do that, they're
probably worth learning about.

Oh! And as far as finding fun exercises to work on goes: Try writing something
that'll automate a chore in your daily life. Say, an automated grocery list,
or a "books to read" list, or an apocalypse-detector that checks every five
minutes to see if Google's down. You know what they say about the sky and the
limit and all that :)

-

[1] “Managing complexity is the most important technical topic in software
development. In my view, it’s so important that Software’s Primary Technical
Imperative has to be managing complexity" - Steve McConnell, Code Complete

[2] "Civilization advances by extending the number of important operations
which we can perform without thinking about them" - Alfred North Whitehead

------
steveklabnik
This is exactly the point of Hackety Hack.

I need to wrap up this OSX and Windows stuff so that I can actually promote
it.

~~~
jrheard
I've never been able to successfully use Hackety Hack, as back when _why was
still actively developing it and I was still on a Windows box, it would always
insta-crash on my machine, but it's always sounded like a great idea, and I'm
definitely looking forward to 1.0!

~~~
steveklabnik
Thanks. The cross-platform nature of shoooes is a lot of work, and it's been
holding up the 1.0 release for a while.

It's looking like a Shoooes 3 release may happen soon, though, and that should
help. I'll certainly let you know when it's usable.

------
jsz0
As someone who's never really been able to break into coding my biggest
problem with most of the learning material is it does not tackle a broader
perspective on problem solving. Learning syntax and libraries is easy. Knowing
where to apply them and how to architect your program is the really hard part.
I'm not sure how you learn that other than experience and for a novice that
means countless hours of work before they can produce anything unique and
useful.

~~~
andrewcooke
have you tried "how to design programs"? <http://www.htdp.org/>

i haven't used it, but i think it's aimed at this kind of problem ( _where to
apply them and how to architect your program_ ).

~~~
jsz0
Thanks I'll check both of these links out. I'm designing a little Google Maps
based web app that has already had two major architectural changes due to
issues I hadn't considered. Before I go forward with it I want to go through
these resources and try to get the third iteration right.

~~~
andrewcooke
HTDP starts off pretty basic, but it's by the same people as SICP (a famous
textbook), and if it's anything like that book, it's "surprisingly deep", so
don't dismiss it too quickly as "too easy"...

------
zavulon
Usually "I stopped reading after..." is used as a metaphor, and the article
still gets read.

In this case though, I really did stop reading after "as a matter of fact, any
self-respecting programmer you’ve ever met is mostly self-taught."

~~~
jrheard
Why?

------
sumeeta
How’d that work out for Reba?

And why did Reba want to learn programming in the first place?

~~~
jrheard
Hopefully it works out pretty well - I haven't heard back from her about it
yet what with school and all, but hopefully she'll have some questions in a
week or so, and working through them would probably be really educational for
both of us.

I think she was probably interested for a couple of reasons.

* First, the house we live in has a strangely high proportion of coders, and so she hears us get really excited in our discussions about programming on a pretty regular basis. I think this is probably one of the main reasons that other people who live in the same house have, in the past, asked me the same question she did.

* Second, she thinks coding seems pretty practical; it comes up in a bunch of fields, so it's probably a pretty useful skill to have.

I think that most of the people I know either have no idea what coding is and
see it as a foreign and scary thing, or, like her, they think that it must be
pretty useful, and are curious about it. It'd be pretty nice if we were able
to convert those in the former camp to be in the latter, but I think that
what's even more important than that is that people who are already curious
about programming should _immediately_ be made aware of the fact that
programming is fun as hell.

------
meox
I am trying to learn; currently reading how to think like a computer scientist
on Green Tea Press.

~~~
jrheard
Best of luck! Sounds like a pretty good idea, actually - I just grabbed the
.pdf for the manuscript of the Python version of the book from
<http://greenteapress.com/thinkpython/thinkpython.html> and sent it off to my
Kindle for a rainy day.

------
yashodhan
Should I learn PHP or Ruby?

~~~
jrheard
Just like everything else, the decision's based on nothing but trade-offs.
Here's my analysis.

If you learn PHP:

* You'll be able to see results running in your Web browser a lot quicker

* Your knowledge will be really relevant if you're looking to work on slightly older, more established Web sites like Facebook or Yahoo!, but

* You probably won't learn very good programming practices on your own - PHP has been pretty notorious for this, but maybe this has changed with PHP5, I haven't been keeping up.

If you learn Ruby:

* First you'll have to learn the language, and then you'll basically have to learn a framework like Sinatra or Rails before you'll be able to do awesome Web things

* Your knowledge will be really relevant to most startup-style Web sites begun since 2005 or so (e.g. Yelp, which is written in Python, which is _basically_ sort of like a sister language to Ruby, _give or take_ )

* You'll be much more likely to learn a lot of really good programming practices as you go that will serve you throughout your career.

Having worked with both PHP and Ruby, I'd recommend Ruby, because I think it's
easier to learn, it's more fun, and it's a better investment; I'm pretty sure
most HNers would agree if given the choice between those two languages, but
your sample of respondents is probably pretty biased :)

~~~
rick888
"Your knowledge will be really relevant if you're looking to work on slightly
older, more established Web sites like Facebook or Yahoo!"

Many newer sites are using PHP as well. PHP is used on established sites, but
that just means that it's a proven concept. I also see many more jobs for php
developers than Ruby (I have seen a few startups using ruby).

"You probably won't learn very good programming practices on your own - PHP
has been pretty notorious for this, but maybe this has changed with PHP5, I
haven't been keeping up."

I suppose this is true. But I think you can pickup good programming practices
in any language.

Another reason to learn php is because it uses a C-style syntax, which will
make it much easier to transition to other languages like
c/c++/javascript/c#/Java.

Ruby uses a syntax all its own that you can pretty much only use in Ruby.

I also don't feel people should be learning a programming language through
frameworks. It's like learning how to add and subtract using a calculator.

What beginners need to learn is programming concepts that they can use in any
language.

~~~
jrheard
You've definitely got some valid points. I think I may be biased toward Ruby
and Python because I like programming in them so much, in addition to the fact
that I feel that my knowledge of them directly contributed to the quality and
quantity of job offers I received when I was on the market.

My enjoyment of programming in Ruby and Python may have something to do with
them both being scripting languages, and having easily-accessible REPLs (for
the uninitiated: Read-Eval-Print-Loops, like irb, a program I mention and show
example output from in my post). In addition, scripting languages just... feel
_easier_. If you've got Python installed on your computer, go ahead and pop up
a terminal if you'd like to follow along:

    
    
      [jrheard@jrheard:~]$ python
      >>> import webbrowser
      >>> webbrowser.open_new('http://google.com')
      True
    

If you weren't following along: Firefox just opened a new tab with Google in
it! Isn't that awesome? How many lines would that be in C?

    
    
      >>> import urllib
      >>> goog = urllib.urlopen('http://google.com')
      >>> page_source = goog.read()
      >>> len(page_source)
      6917
      >>> page_source[:27]
      '<!doctype html><html><head>'
    

The real power of Python and Ruby is that I can do awesome stuff without even
thinking about it. At all. At least half the time I have a problem, the most I
have to do is one Google search to find the built-in library I need.

The point I'm trying to make is that, syntax aside, I feel like Python and
Ruby just get out of my way most of the time, so I can focus on solving
problems and learning programming concepts I can learn in any language.

Jeff Atwood sums up a lot of my sentiments in his post "A Scripter At Heart",
which you can read at [http://www.codinghorror.com/blog/2009/01/a-scripter-at-
heart...](http://www.codinghorror.com/blog/2009/01/a-scripter-at-heart.html) .

