Expanded Ruby Under a Microscope Available in Print!

Order your copy today at NoStarch.com
Use coupon code LENS to get a 40% discount!

I’m happy to announce Ruby Under a Microscope is now available in print!

Ruby Under a Microscope gives you a hands-on look at Ruby’s core, using extensive diagrams and thorough explanations to show you how Ruby is implemented (no C skills required). I take a scientific approach, laying out a series of experiments with Ruby code to take you behind the scenes of how programming languages work. You’ll even find information on JRuby and Rubinius (two alternative implementations of Ruby), as well as in-depth explorations of Ruby’s garbage collection algorithm.

Ruby Under a Microscope will teach you:

  • How a few computer science concepts underpin Ruby’s complex implementation
  • How Ruby executes your code using a virtual machine
  • How classes and modules are the same inside Ruby
  • How Ruby employs algorithms originally developed for Lisp
  • How Ruby uses grammar rules to parse and understand your code
  • How your Ruby code is translated into a different language by a compiler.

No programming language needs to be a black box. Whether you’re already intrigued by language implementation or just want to dig deeper into Ruby, you’ll find Ruby Under a Microscope a fascinating way to become a better programmer.

What’s New in the Expanded Book?

Professionally edited and produced, the expanded book covers important new features introduced with Ruby 2.0: Module#prepend, keyword arguments, refinements and more. You’ll learn how to use them… and even how Ruby 2.0 implements them internally! I also updated the text and diagrams from my 2012 eBook to account for important changes to Ruby’s virtual machine (YARV) made during 2.0 release, and added new chapters covering JRuby, Rubinius and garbage collection.

I had the honor of working with Aaron “tenderlove” Patterson on the project, who was the technical reviewer. Thanks to Aaron, the expanded book is both more accurate and more interesting: Aaron had a number of great suggestions for new content which I included as well.

A 40% Discount

For the next seven days only, I’m offering a special discount: Use coupon code “LENS” on NoStarch.com to get a 40% discount. The LENS code will be valid for one week only, so be sure to order your copy today! No Starch plans to start shipping the new books Monday, Nov. 11th.

A Free Chapter Online

No Starch has posted Chapter 6, “Module Lookup and Constant Lookup,” as a free online PDF. It discusses how internally Ruby implements modules as classes, how Ruby finds methods you call, and how Ruby uses lexical scope to find constants.

Expanded Table of Contents

Foreword by Aaron Patterson xv
Acknowledgments xvii
Introduction xix
Chapter 1: Tokenization and Parsing 3
Chapter 2: Compilation 31
Chapter 3: How Ruby Executes Your Code 55
Chapter 4: Control Structures and Method Dispatch 83
Chapter 5: Objects and Classes 105
Chapter 6: Method Lookup and Constant Lookup 133
Chapter 7: The Hash Table: The Workhorse of Ruby Internals 167
Chapter 8: How Ruby Borrowed a Decades-Old Idea from Lisp 191
Chapter 9: Metaprogramming 219
Chapter 10: JRuby: Ruby on the JVM 251
Chapter 11: Rubinius: Ruby Implemented with Ruby 273
Chapter 12: Garbage Collection in MRI, JRuby, and Rubinius 295
Index 327