Learn the Language that Powers Rails
Michael Fitzgerald has learned to program a lot of languages over the years—BASIC, FORTRAN, C, C++, Java, and JavaScript, among others—but so far, Ruby is his favorite. Why? “Because it’s been the most fun to learn and use,” he says. This is because of its syntax. If you have a background in a variety of other languages, Ruby is easy to figure out. And it’s flexible: Ruby lets you do things in a variety of ways, not just one way, so you can decide how to do things your way.
“Ruby is here to stay,” says Fitzgerald. “It has a low task-to-keystroke ratio, but registers high on the fun meter. The syntax is intuitive—it just makes sense, especially to those who have object-oriented programming experience.” Fitzgerald’s new book, Learning Ruby (O’Reilly) is geared toward those who’d like to see how and why Ruby programs work. As he points out, you don’t have to know everything about a car to learn to drive one, and you don’t need to know everything about Ruby to start programming with it. Learning Ruby is a just-get-in-and-drive book: a hands-on tutorial that offers lots of Ruby programs to get you rolling down the road.
“People who read this book and apply the simple examples will be Ruby programmers,” says Fitzgerald. “They’ll get to see how to use over 2,000 lines of code and be exposed to about 300 of Ruby’s most commonly used methods.”
Fitzgerald believes that we learn by imitation. His book averages five to ten lines of code per page for readers to imitate and try. “You try a little something and watch what it does,” he says. “This is how we learned as children.”
Highlights of Learning Ruby:
Outlines many of the most important features of Ruby
Demonstrates how to use conditionals, and how to manipulate strings in Ruby. Includes a section on regular expressions
Describes how to use operators, basic math, functions from the Math module, rational numbers, etc.
Talks you through Ruby arrays, and demonstrates hashes in detail
Explains how to process files with Ruby
Discusses Ruby classes and modules (mixins) in detail, including a brief introduction to object-oriented programming (OOP)
Introduces processing XML, the Tk toolkit, RubyGems, reflection, RDoc, embedded Ruby, metaprogramming, exception handling, and other topics
Acquaints you with some of the essentials of Rails, and includes a short Rails tutorial
Each chapter concludes with a set of review questions, and appendices provide you with a glossary of terms related to Ruby programming, plus reference material from the book in one convenient location. If you want to take Ruby out for a drive, Learning Ruby holds the keys.