Datasheet

Ruby is object-oriented
I describe object-oriented programming (OOP) in Chapter 6. So I don’t want
to spoil the fun in this chapter. But to give you a preview, object-oriented pro-
gramming centers around nouns, not verbs. With object-oriented program-
ming, you begin by defining nouns. Each
account has a name and a balance.
Each
customer has a name, an address, and one or more accounts.
After describing the nouns, you start applying verbs. Create a new account
for a particular customer.
Display the account’s balance. And so on.
Since the late 1980s, most commonly used programming languages have
been object oriented. So I can’t claim that Ruby is special this way. But
Ruby’s object-oriented style is more free-form than its equivalent in other
languages. Again, for more details on object-oriented programming in Ruby,
see Chapter 6.
Why Rails?
Rails is an add-on to the Ruby programming language. This add-on contains a
library full of Ruby code, scripts for generating parts of applications, and a
lot more.
The name
Ruby on Rails is an inside joke. Since the year 2000, teams of
Java programmers have been using a framework named
Struts. The Struts
framework addresses many of the problems described in this chapter —
Web development, databases, and other such things. But the word
strut
means something in the construction industry. (A strut is a horizontal brace,
and a sturdy one at that.) Well, a
rail is also a kind of horizontal brace.
And like
Ruby, the word Rail begins with the letter R. Thus the name
Ruby on Rails.
In spite of the name Ruby on Rails, you don’t add Ruby on top of Rails. Rather,
the Rails framework is an add-on to the Ruby programming language.
Figure 1-2:
Running the
code with
more com-
plicated
input.
17
Chapter 1: Welcome to the World of Ruby on Rails
05_081204 ch01.qxp 11/30/06 11:09 PM Page 17