Learn to Program: Using Ruby (Facets of Ruby)
Learn to Program: Using Ruby (Facets of Ruby) by Chris Pine
- Binding:
- Paperback
- Number of Pages:
- 200
- ISBN:
- 1934356360
- Product Group:
- book
- Publisher:
- Pragmatic Bookshelf
- Publication Date:
- March 24, 2009
- BooksForGeeks.com ID:
- 1961
Reviews for Learn to Program: Using Ruby (Facets of Ruby)
-
Well worth the money
Rated out of 5 stars, August 12st, 2009
Excellent little book to teach you the fundamentals of programming. It uses Ruby as the teaching tool but all aspects are transferable to other programming languages. Writing style is subtly witty without being annoying. Lots of easy to follow examples to illustrate points. Also has a section to show you how a pro would write the code to make it just that little bit cleaner - which is very informative! I'd definitely recommend this to anyone wanting to learn the basics of programming. -
The best "learn Ruby" book. The best "learn to program" book
Rated out of 5 stars, June 12th, 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 he 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 hands-down the most accessible and therefore best book you can buy. And you should buy it. Now. -
Never programmed before? Buy this book!
Rated out of 5 stars, March 12th, 2008
I bought this book having always been curious about programming but afraid that the learning curve would be too high for me to overcome. This book proved me wrong: within an hour I had written a simple program that works out the number of seconds for which you have been alive.
In the course of the book you will learn, amongst other things, how to get your computer to do math for you, how to make a "deaf grandma" program (which will chat with you) and how to create simple text games.
At no point in the book will you be left confused. The author clearly explains each new concept introduced, both in English and by means of working code. An even deeper understanding of each concept used will come to you by attempting the interesting exercises provided at the end of each chapter.
Highly recommended! By the end of this book you will want to personally thank the author for writing such a helpful book. -
Superb Beginners Guide
Rated out of 5 stars, February 12th, 2007
I was new to Ruby and object-orientated programming untill reading this book. It teaches you many of the basics and is extremely fun to follow and read.
The examples aren't realistic but easily demonstrate the different ways in which the code can be used. I went from no knowledge and now I can make interactive programmes. A must by too those who are new to ruby and general OO programming.

