Learn to Program, by Chris Pine
Learn to Program, by Chris Pine
Unfortunately, there wasn't much Ruby documentation geared for newbies at the
time. Some of us in the community were talking about what such a "Ruby for the
Nuby" tutorial would need, and more generally, how to teach programming at all.
The more I thought about this, the more I had to say (which surprised me a bit).
Finally, someone said, "Chris, why don't you just write a tutorial instead of
talking about it?" So I did.
answers now included!
And it wasn't very good. I had all these ideas that were good in theory, but the
actual task of making a great tutorial for non-programmers was vastly more
challenging than I had realized. (I mean, it seemed good to me, but I already
« the original tutorial »
knew how to program.)
What saved me was that I made it really easy for people to contact me, and I
0. Getting Started
1. Numbers
always tried to help people when they got stuck. When I saw a lot of people
2. Letters getting stuck in one place, I'd rewrite it. It was a lot of work, but it slowly got
3. Variables and Assignment better and better.
4. Mixing It Up
5. More About Methods
A couple of years later, it was getting pretty good. :-) So good, in fact, that I was
6. Flow Control
7. Arrays and Iterators ready to pronounce it finished, and move on to something else. And right about
8. Writing Your Own Methods then came an opportunity to turn the tutorial into a book. Since it was already
9. Classes
basically done, I figured this would be no problem. I'd just clean up a few spots,
10. Blocks and Procs
11. Beyond This Tutorial add some more exercises, maybe some more examples, a few more chapters, run
it by 50 more reviewers...
It took me another year, but now I think it's really really good, mostly because of
the hundreds of brave souls who have helped me write it.
« translations »
What's here on this site is the original tutorial, more or less unchanged since
Bosnian by Rusmir Gadžo 2004. For the latest and greatest, you'll want to check out the book.
Br. Portuguese by Fabio Akita et al.
Danish by Gunner Carstens
French by Jean‑Pierre ANGHEL
German by Anja Stiedl
Italian by Duccio Armenise Thoughts For Teachers
Korean by engfordev
Spanish by David O' Rojo There were a few guiding principles that I tried to stick to. I think they make the
Spanish by rubysur
learning process much smoother; learning to program is hard enough as it is. If
Turkish by Niyazi ATEŞ
you're teaching or guiding someone on the road to hackerdom, these ideas might
help you, too.
First, I tried to separate concepts as much as possible, so that the student would
only have to learn one concept at a time. This was difficult at first, but a little too
easy after I had some practice. Some things must be taught before others, but I
was amazed at how little of a precedence hierarchy there really is. Eventually, I
just had to pick an order, and I tried to arrange things so that each new section
was motivated by the previous ones.
Another principle I've kept in mind is to teach only one way to do something. It's
an obvious benefit in a tutorial for people who have never programmed before.
For one thing, one way to do something is easier to learn than two. Perhaps the
more important benefit, though, is that the fewer things you teach a new
programmer, the more creative and clever they have to be in their programming.
Since so much of programming is problem solving, it's crucial to encourage that
as much as possible at every stage.
As far as the exercises are concerned, I think I came up with some good ones, but
you can never have too many. Honestly, I bet I spent half of my time just trying to
come up with fun, interesting exercises. Boring exercises absolutely kill any
desire to program, while the perfect exercise creates an itch the new programmer
can't help but scratch. In short, you just can't spend too much time coming up
with good exercises.
Acknowledgements
Finally, I'd like to thank everyone on the ruby-talk mailing list for their thoughts
and encouragement, all of my wonderful reviewers for their help in making the
book far better than I could have alone, my dear wife especially for being my
main reviewer/tester/guinea-pig/muse, Matz for creating this fabulous language,
and the Pragmatic Programmers for telling me about it—and, of course, for
publishing my book!
If you notice any errors or typos, or have any comments or suggestions or good
exercises I could include, please let me know.