Pages

Saturday, March 11, 2017

Ruby Under a Microscope

Recently, I started reading Ruby Under a Microscope, by Pat Shaughnessy. Being a Ruby programmer for the last three years, I felt this is a good time to start reading it. To give you a brief idea, this book explains what happens behind the scenes while executing a Ruby program. I started just out of curiosity and without even reading any reviews online.



I am currently reading the second chapter of the book. The amount of information the book has packed into each of the chapter is really astonishing. In fact, I was able to give a 45 mins talk to my fellow programmers at Multunus just with the first chapter!

The book starts from the moment when you execute a ruby script with the command:

ruby your_script.rb
From there, it is a walkthrough on how ruby reads, tokenises, parses and compiles the program into something the underlying Ruby Virtual Machine understands. For me, this was a pragmatic recap of compiler theory from my college days. What I learned then was just theory. Here, Pat shows the actual source code which does what is meant to be done! I got a new perspective on the basic concepts like tokenising and grammar parsing just by reading the first chapter. This book gave me courage to go through the actual ruby source code written in C!

If you are a Ruby programmer, and if you care about fundamentals of computer science like compiler theory, don’t think twice. You should read this book. As I told already, I am in the second chapter of the book as of now. So far so good. I will post a detailed review with my learnings once I complete the book.