Chapter 1. Ruby in Review
IN THIS CHAPTER
Some Words on Object Orientation
Basic Ruby Syntax and Semantics
OOP in Ruby
Dynamic Aspects of Ruby
Training Your Intuition: Things to Remember
Language shapes the way we think and determines what we can think about.
Benjamin Lee Whorf
It is worth remembering that a new programming language is sometimes viewed as a panacea, especially by its adherents; however, there is no one language that will supplant all the others, no one tool that is unarguably the best for every possible task. There are many different problem domains in the world, and there are many possible constraints on problems within those domains.
Above all, there are different ways of thinking about these problems, stemming from the diverse backgrounds and personalities of the programmers themselves. For these reasons, no foreseeable end to the proliferation of languages is in site. As long as there is a multiplicity of languages, there will be a multiplicity of personalities defending and attacking them. In short, there will always be "language wars." In this book, however, we do not intend to participate in them.
Yet, in the constant quest for what is newer and better program notations, we have stumbled across ideas that endure, that transcend the context in which they were created. Just as Pascal borrowed from Algol, just as Java borrowed from C, so will every language borrow from its predecessors. A language is both a toolbox and a playground; it has its extremely practical side, but it also serves as a test bed for new ideas that may or may not be widely accepted by the computing community.
One of the most far reaching of these ideas is the concept of object-oriented programming (OOP). Although many would argue that the overall significance of OOP is evolutionary rather than revolutionary, no one can say that it has not had an impact on the industry. Twenty years ago, object orientation was for the most part an academic curiosity; today it is a universally accepted paradigm.
In fact, the ubiquitous nature of OOP has led to a significant amount of "hype" in the industry. In a classic paper of the late 80s, Roger King observed, "If you want to sell a cat to a computer scientist, you have to tell him it's object-oriented." Additionally, there are differences of opinion about what OOP really is, and even among those who are essentially in agreement there are differences in terminology.
It is not our purpose here to contribute to the hype. We do find OOP to be a useful tool and a meaningful way of thinking about problems; however, we do not claim that it cures cancer.
As for the exact nature of OOP, we have our pet definitions and favorite terminology, but we make these known only in order to communicate effectively, not to quibble over semantics.
We mention all this because it is necessary to have a basic understanding of OOP in order to proceed to the bulk of this book and understand the examples and techniques. Whatever else might be said about Ruby, it is definitely an object-oriented language.