Ruby Mastery: The Most Important Chapter You Can Read on Ruby
 
 
Mark_2 Mark Menard
August 27, 2012
Mark_2 Mark Menard
August 27, 2012

There are a decent number of books out there on Ruby. In my mind I consider Chapter 11 of The Ruby Way, 2nd Edition the most important chapter you can read. Here's why.

Mastery in Ruby involves moving past regular programming and embracing the dynamic features of the language. The dynamic nature of Ruby goes far beyond dynamic typing. Frequently programmers coming to Ruby from languages like Java, C++/C#, PHP, VB.Net, and other statically and dynamically typed languages think that dynamic typing is the extent of what is dynamic about Ruby[1]. Chapter 11 of The Ruby Way will greatly disabuse them of this notion and put them on the pathway to Ruby mastery.

So, what is dynamic in Ruby beyond typing? In short metaprogramming, which provides the ability to use code to write code, eliminate repetition and arrive at higher abstractions. Until you start using the metaprogramming facilities of Ruby you're really just writing Java/C++/C# or whatever language you came from in Ruby.

What makes chapter 11 of The Ruby Way so good is it covers most of the advanced facilities of Ruby in a succinct form. The juicy stuff starts in section 11.2 More Advanced Techniques. This sections covers:

These advanced techniques form the foundation on which to begin your metaprogramming in Ruby. Section 11.3 really starts to dig in, covering:

If you are coming to Ruby from another language that does not feature metaprogramming as a feature do yourself a favor and pick up a copy of The Ruby Way and read and re-read chapter 11 until you get it.

[1] If you're coming from another dynamic language like Smalltalk or Lisp you already understand what dynamic means.

 
 
 

Newsletter Sign-Up

Be the first to find out about the goings on at the Lab!

Email: