Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Developer Reading List

, December 03, 2013 Ruby, Python, ASP.NET, Android development, PDF, and more.
  • E-mail
  • Print

Ruby Under A Microscope

by Pat Shaughnessy

I don't think there is a programmer alive who has not felt, at one time or another, a deep, nerdy interest in learning how languages are implemented. The great problem with this interest is that most books that try to satisfy it descend quickly into so much detail and often unneeded theory that the topic is quickly drained of its fun. (How many promising CS careers were driven off the rails by classes that used the Dragon Book as their textbook?)

Ruby Under A Microscope, however, understands the fun of knowing the workings of the language, not to say the benefits of this knowledge in day-to-day programming. The author, who clearly has researched Ruby's internals to the point of having remarkable understanding of their operation, explains most everything in straightforward terms.

The first two chapters discuss how Ruby code is parsed and compiled. The next five chapters detail the design of the Ruby VM (in this case, the MRI) and how it translates the bytecodes into actions. Finally, the author explores two MRI alternatives: JRuby (Ruby on the JVM) and Rubinius (Ruby VM is written in Ruby; MRI, the principal VM, is written in C.)

The explanations are pleasantly clear for what are, at times, advanced topics. Part of this clarity derives from liberal use of diagrams, which illustrate in small steps exactly how the stack is used in instruction execution and how various instructions affect stack operations. Objects and classes get their own chapter, so that it's easy to understand in later topics what exactly are the atomic-level components being handled. Subsequent chapters discuss method lookup, the VM's hash tables and the special role they play in execution, and finally metaprogramming. More than many of the other topics, understanding how metaprogramming is handled internally by Ruby clarifies how it is best used in software development.

While the book keeps the material interesting throughout, it requires a good grasp of Ruby to be appreciated. Minor details of the language are often explored as preparation to larger topics, which is a bar to reading this book with only basic Ruby skills. If you don't have the necessary grounding, much of the detail will simply go by unappreciated and eventually knowing the last little bits will prove uninteresting. In other words, this is not at all a book for a newcomer to the language — rather, it requires expertise and experience with Ruby. That being said, nearly every Ruby expert will benefit from knowing so much about how the language and runtime operate.

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.