Re: Book wanted: Metaprogramming in Ruby

I’d love to see an Advanced Ruby book targeted towards experienced
programmers that are mostly familiar with the C family of compiled
languages. As I’ve been teaching myself Ruby over the last several
months, I’ve run across a lot of programming techniques that are pretty
alien to the “Business Process Programming” crowd I normally hang out
with. The landscape over here is covered with shrines to C# and Java,
plus the occasional dusty, decaying monument to Visual Basic or Delphi
– almost all built on Windows. I’ve had a lot of fun digging in to some
of these new concepts. Metaprogramming, Higher Order Programming,
Functional Programming, plus a collection of similar concepts that a lot
of people seem to refer to simply as “Ruby Magic.”

When I first learned Object-Oriented programming years ago*, there was a
time when I thought I understood it (in an abstract sort of way), but I
wasn’t quite sure how to put it into practice. Then there was that
“Aha!” moment when everything fell into place. The same thing has been
true for me while learning “Advanced” Ruby. At first all I had was a
collection of independent bits of code and blog articles that all
offered insight into Ruby magic. It wasn’t until I started to understand
how the Ruby interpreter works that I had my “Aha!” moment, and
everything started to fall into place.

Here’s a good example. In other languages, when I declare a function,
class or module, I think of it as nothing more than a placeholder; a
description for the compiler for an empty, rigid shell that you fill in
with executable code to get all the bits and pieces of code (hopefully)
working together. When I first truly understood that when you declare a
class in Ruby you are executing code at runtime, and that you’re
creating a new object that contains the definition of that class, it was
a real eye-opener. Suddenly a lot of those bits and pieces became
examples of one overall concept, and then they all seemed a lot smaller
and easier to remember.

I’ve had this idea in the back of my head for a Ruby book I wish I could
read, that starts with how ruby works (how the interpreter “thinks”, so
to speak) and builds outward from there to how you can use it to do
various Neat Tricks. I’m on shakier ground here, but I think that same
concept might work for other advanced topics such as concurrency, by
viewing concurrency through the eyes of Ruby, and maybe comparing it
with what else is out there (What the heck are “green threads” and what
are the advantages/disadvantages? What are the similarities/differences
between Ruby “messages” and the “message passing” concept in Erlang?)

Does anybody out there think I’m on the right track?

Frank Davis

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs