Developer Reading List, December 03, 2013 Ruby, Python, ASP.NET, Android development, PDF, and more.
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.