Chapter5. OOP and Dynamicity in Ruby


Ruby Way
By Hal Fulton
Slots : 1.0
Table of Contents

Chapter 5. OOP and Dynamicity in Ruby


  • Everyday OOP Tasks

  • More Advanced Techniques

  • Working in Advanced Programming Disciplines

  • Summary

Just as the introduction of the irrational numbers… is a convenient myth [which] simplifies the laws of arithmetic… so physical objects are postulated entities which round out and simplify our account of the flux of existence…. The conceptional scheme of physical objects is [likewise] a convenient myth, simpler than the literal truth and yet containing that literal truth as a scattered part.

Willard Van Orman Quine

This is an unusual chapter. Whereas most of the chapters in this book deal with a specific problem domain, this one doesn't. If the problem space is viewed as stretching out on one axis of a graph, this chapter extends out on the other axis, encompassing a slice of each of the problem domains. This is because object-oriented programming and dynamicity aren't problem domains themselves, but are paradigms that can be applied to any problem whether it be system administration, low-level networking, or Web development.

For this reason, much of this chapter's information should already be familiar to a programmer who knows Ruby. In fact, the rest of the book wouldn't make sense without some of the fundamental knowledge here. Any Ruby programmer knows how to create a subclass, for instance.

This raises the question of what to include and what to exclude. Does every Ruby programmer know about the extend method? What about the instance_eval method? What is obvious to one person might be big news to another.

We have decided to err on the side of completeness. We include in this chapter some of the more esoteric tasks you might want to do with dynamic OOP in Ruby, but we also include the more routine tasks in case anyone is unfamiliar with them. We go right down to the simplest level because people don't agree on where the middle level ends. And we have tried to offer a little extra information even on the most basic of topics to justify their inclusion here. On the other hand, topics that are fully covered elsewhere in the book are omitted here.

We'll also make two other comments. First of all, there is nothing magical about dynamic OOP. Ruby's object orientation and its dynamic nature do interact with each other, but they aren't inherently interrelated; we put them in a single chapter largely for convenience. Second, some language features might be mentioned here that aren't strictly related to either topic. Consider this to be cheating, if you will. We wanted to put them somewhere.




The Ruby Way
The Ruby Way, Second Edition: Solutions and Techniques in Ruby Programming (2nd Edition)
ISBN: 0672328844
EAN: 2147483647
Year: 2000
Pages: 119
Authors: Hal Fulton

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: