Perl, Python, Java, Smalltalk, and the shell scripts of UNIX. You actually
can find a lot of syntax common between Ruby and C. Ruby can be com-
pared with Perl and Python because both Perl and Python are scripting
languages. What you can do in Ruby you also can do in Perl and Python.
The only difference is that Ruby is much more flexible than Perl and
Python. Creating applications in Ruby is much easier than creating appli-
cations in Perl and Python. Ruby can be compared with Smalltalk because
both are true object-oriented programming languages. Ruby is similar to
Java only in terms of showing multiple inheritance. Both Ruby and Java
implement multiple inheritance indirectly, unlike C++, which shows mul-
tiple inheritance directly.
How This Book Is Organized
This book shrugs away from the traditional content-based approach and
uses the problem-based approach to deliver the concepts of Ruby. Prob-
lems used in the book are presented against the backdrop of real-life sce-
narios. Each problem is followed by a task list that helps you to solve the
given problem, in the process delivering the concepts and their implemen-
tation. This practical approach will help you to understand the real-life
application of the language and its use in various scenarios. Moreover, to
provide appropriate learning experience, the concepts will be supported
adequately by case studies that will be formulated in such a way that they
provide you with a frame of reference.
This book is organized into two parts. The first part involves program-
ming with Ruby using arrays, hashes, methods, and modules. And the sec-
ond part delves into developing advanced applications with Ruby using
CGI, GUI, and networking features.
Chapter 1 introduces you to Ruby. It also guides you to where you can
obtain Ruby and its documentation. Finally, it instructs you on how to
install Ruby and discusses the different modes in which you can run Ruby.
Chapter 2 deals purely with object orientation. This chapter gives you an
overview of object-orientation concepts. You also learn to implement object
orientation by using Ruby.
Chapter 3 introduces you to the different data types in Ruby. It discusses
how to implement arrays and hashes in Ruby. You will move a step further
and learn how to implement ranges in Ruby.
Chapter 4 introduces you to the various control structures supported by
Ruby. Then you will learn to implement blocks and iterators in Ruby.
Finally, you will learn the important concept of regular expressions.
xviii Introduction