"Ruby by Example, Concepts and Code" teaches the Ruby language through immersion in examples.
The book begins with a brief introduction to Ruby and the interactive Ruby shell (which allows typing in Ruby code and immediately seeing the results).
The 45 examples that follow are carefully crafted to introduce new language features. A typical example includes these sections:
* The Code
* How It Works
* Running the Script
* The Results
* Hacking the Script
The reader is tempted to open up the examples in an editor, run them and tinker with them.
There is a focus on programming paradigms (or styles). The three main types covered are: imperative, object-oriented and functional. The imperative style "tells computers: Do this, then do that, then do this next thing." "Object-oriented languages define objects (types of things) that know how to perform methods." "Functional languages treat programming problems like mathematical relationships" and allow handling of functions and blocks of codes as if they were objects themselves. Ruby has strengths in all three of these areas, but this book offers more coverage of the functional paradigm than you might see elsewhere.
The examples advance in scope and complexity and cover practical topics like HTML and XML handling, CGI programming (which is a simple technique to make programmable web pages) and finally a sample Ruby on Rails web application.
An appendix compares and contrasts Ruby to several other languages (C, Haskell, Java, Lisp, Perl, PHP, Python and Smalltalk). For each language, the author gives some history, the particular focus or strengths of that language, and how Ruby was inspired by or shares some of the best features of each.
Baird sees Ruby's greatest strengths as "readability, a high level of abstraction (and great ease in extending that abstraction even higher), internal consistency and conceptual elegance."
The book is designed to be accessible to a beginning programmer, but would be challenging (in a good way).
Programmers with experience in another language or with some Ruby experience would strongly benefit from reading "Ruby by Example", even if they have read another tutorial book or started working with Rails applications.
|