BUY THIS BOOK
Add to Cart

Print Book $29.95


Safari Books Online

What is this?

Ruby by Example Concepts and Code

By Kevin C. Baird
June 2007
Publisher: No Starch Press
Pages: 294
ISBN 10: 1-59327-148-4 | ISBN 13: 9781593271480
starstarstarstarstar (Average of 2 Customer Reviews)

Buy 2 Get 1 Free Free ShippingGuarantee

Book description

Perfect for programmers at all levels, Ruby by Example explores Ruby's functional power through the use of numerous practical and illustrative examples. The book includes short scripts, ranging from the simple to the complex, that do something interesting while also illustrating key concepts in Ruby. These scripts manipulate text, manipulate numbers (in ways that extend Ruby's numeric classes), and much more, all while showing readers how to use the language to extend itself.
Full Description

There may be no better way to learn how to program than by dissecting real, representative examples written in your language of choice. Ruby by Example analyzes a series of Ruby scripts, examining how the code works, explaining the concepts it illustrates, and showing how to modify it to suit your needs. Baird's examples demonstrate key features of the language (such as inheritance, encapsulation, higher-order functions, and recursion), while simultaneously solving difficult problems (such as validating XML, creating a bilingual program, and creating command-line interfaces). Each chapter builds upon the previous, and each key concept is highlighted in the margin to make it easier for you to navigate the book.

You'll learn how to:

  • Use the interactive Ruby shell (irb) to learn key features of the language
  • Extend Ruby using RubyGems, the Ruby package manager
  • Create numerical utilities, as well as utilities that process and analyze HTML/XML
  • Implement purely functional and metaprogramming techniques to save time and effort
  • Optimize, profile, and test your code to make sure that it not only does its job, but does it well
  • Create web applications using Rails


Ruby is the fastest growing programming language today, and for good reason: Its elegant syntax and readable code make for prolific and happy programmers. But it can be difficult to understand and implement without a little help. Ruby by Example shows you how to take advantage of Ruby as you explore Ruby's fundamental concepts in action.

Post-purchase benefits:

Register your book | Submit Errata


Browse within this book

Cover

Book details

First Edition: June 2007
Publisher: No Starch Press
ISBN: 1-59327-148-4
Pages: 294
Average Customer Reviews: starstarstarstarstar (Based on 2 Reviews)


Featured customer reviews

Write a Review


And now for something completely different…,  April 21 2008
Rating: StarStarStarStarStar
Submitted by joshSVUG   [Respond | View]

By all means, this is a new approach to programming books, and for he most part it works. I read through the first few chapters picking up Ruby wisdom right and left but in later chapters I lost interest in the examples (but not the book).

If you are willing to try something new – this is for you!



Learn Ruby Via Language Immersion,  October 02 2007
Rating: StarStarStarStarStar
Submitted by Scott Schram   [Respond | View]

"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.


Read all reviews


Media reviews
"For those who have some experience of Ruby the book is an excellent resource for improving one's understanding of Ruby and using it more effectively."
-- Major Keary, Book News

Hide extended reviews

Ruby by Example