Datasheet

Language isn’t a neutral medium of expression. Language influences the
nature of the message. A free-flowing style encourages free-flowing thought.
In the same way, a flexible programming language complements an agile soft-
ware development process.
Why Ruby?
Ruby is a computer programming language. You might be familiar with Basic,
Java, C++, or some other programming language. In certain ways, all these
languages are the same. They all provide ways for you to give instructions to
a computer. “Move this value from that memory location to that other location
on your hard drive.” A computer language is a way of expressing instructions
in a precise, unambiguous manner.
What makes Ruby different from so many other computer programming lan-
guages? In what way does Ruby support agile development?
Here’s the answer: Ruby is a dynamically typed, interpreted, reflective,
object-oriented language. That’s a great answer, but what does it mean?
Ruby is dynamically typed
In many languages, you have to declare each variable’s type. You write
int date;
date = 25092006;
The first line tells the computer that the date must store an integer — a whole
number — a number without a decimal point — a number like
25092006.
Later in the same program, you might write
date = “September 25, 2006”;
But the computer refuses to accept this new line of code. The computer flags
this line with an error message. The value
“September 25, 2006” isn’t an
integer. (In fact, “September 25, 2006” isn’t a number.) And because of the
int date; line, the non-Ruby program expects date to store an integer.
The word
int stands for a type of value. In a statically typed language, a vari-
able’s type doesn’t change.
In contrast, Ruby is
dynamically typed. The following lines form a complete,
valid Ruby program:
date = 25092006
date = “September 25, 2006”
14
Part I: Nuts and Bolts
05_081204 ch01.qxp 11/30/06 11:09 PM Page 14