Most helpful positive review
10 of 10 people found the following review helpful
The best "learn Ruby" book. The best "learn to program" book
on 18 June 2009
No mucking about: Chapter 1 tells you how to download Ruby onto your computer. It's a reasonably painless process, albeit not quite as simple as just clicking on a "Download Ruby" button. Chapter 2 and you are straight into writing your first program:
Puts 1 + 2
When you run it by pressing ENTER, you will get ..... drumroll .... 3
"Puts 3*2" will give you 6, and "Puts 3/2" will give you.... no, I'll let you find out for yourself.
From this simple beginning, Chris Pine helps you steadily build a remarkable command of programming (a beginner's command anyway). His language of choice is "Ruby", elegant and simple, yet remarkably flexible & powerful. I had previously bought myself a "Teach Yourself Java" book. But I couldn't get on with Java. Did a programming language really have to be so clumsy, so tortuous? (And I understand Java is simpler than most). Did there not exist a cleaner, more intuitive language? So I did some research on the net, which is how I first came across Ruby. But that's Ruby. What about the book?
Unlike pretty much every other programming book I've ever bought/read, Chris (he's not the "Mr Pine" type) writes as if he is teaching you how to program - rather than how to pass an exam in programming. Rather than blinding you with science, he just helps you learn by doing. He is like the best teacher you (n)ever had, there at your elbow with a word of encouragement or support when you need it, standing back letting you get on with it when you don't. About half way through the book, I suddenly realised - "Wow, this is what they mean by Object Oriented" I can see now why they make such a fuss about it. I don't know I could write a textbook explanation of what it is, but I understand it. And that's more important. To me anyway.
The book contains many exercises such as writing a program to convert dates into Roman Numerals. The exercises are probably the most valuable thing in the book. You'll learn far more by doing them than by reading the main text - though without the main text you wouldn't even get started of course.
On pages 86/87 Chris considers the challenge of how to calculate the area of a (randomly-generated) continent (for the computer game "Civilization"). Chris represents the world map with arrays. An array is a sort of list, for example you could have an array of odd numbers between 7 and 13 inclusive - it would have 4 elements. Ruby lets you manipulate such arrays - for example changing or sorting the elements, adding new elements, etc. Chris then shows how to use a technique you'll learn about called "Recursion" to calculate the area of a continent on the map. He then points out that his program will run into problems if the continent touches the edge of the map - which it often will. He challenges you to come up with a way to solve that problem.
You can further extend your code to cover a cylindrical world, or even a toroidal (doughnut-shaped) world.
I should add that the exercises are very carefully chosen; they help you practise what you've just read, but invariably require you to extend your thinking beyond the worked example. And they are nicely paced, I found nothing too easy or impossibly difficult. Chris never spoon-feeds you, he always makes you work. But he never sets an unrealistic challenge.
For the sake of balance, I'd better find something negative to say: Chris Pine is clearly a Nice Guy, but sometimes the examples he uses - "Cows go moo" are a bit babyish for my taste. This shouldn't put you off though. There's probably more padding than the average computer book, but with a subject as dry as programming, maybe a bit of padding helps the flow.
The second edition is greatly expanded (216 pages compared to 149). The biggest change is the addition of answers. Perhaps Chris got fed up of replying to "Help, I'm stuck!" emails. I myself will admit to occasionally feeling frustrated when I was temporarily stuck (I own the no-answers first edition). But here's the thing: Without answers to turn to, I couldn't take the easy option, I had to work it out for myself. Which forced me to think harder, and so made me a better programmer. But I can't really claim the addition of answers makes the second edition inferior.
I have since bought half a dozen more Ruby/Rails books, including the encyclopaedic reference "Pickaxe" Programming Ruby: The Pragmatic Programmers' Guide (3rd Edition) (930 pages, don't drop it on your foot). My favourite of these additional purchases is probably the 358-page Ruby Programming for the Absolute Beginner. Okay, it covers much the same ground (and more, it has 358 pages) as L2P, but usually from a different angle. I found having another perspective on Ruby helped my learning process - things I had not fully understood in L2P became clearer when explained differently. But this is not to say that I think RP4TAB is a better book than L2P; it isn't (IMO). It's just that having something explained two different ways by two different people can often make things easier to understand than would be the case if you had only the one explanation to go by. Similar comments apply for the 630-page (NB it would seem that the thicker they get, the more textbooky they get) Beginning Ruby: From Novice to Professional, 2nd Edition (Expert's Voice in Open Source).
"Learn to Program" may not be the most comprehensive book on Ruby. In fact it's probably the least comprehensive. But for a beginner's guide to Ruby (and probably to programming generally), "Learn to Program" is easily the most accessible I have found.