Metaprogramming Ruby: Program Like the Ruby Pros

Metaprogramming Ruby: Program Like the Ruby Pros

4.43 of 5 stars 4.43  ·  rating details  ·  246 ratings  ·  32 reviews
Everyone in the Ruby world seems to be talking about metaprogramming--how you can use it to remove duplication in your code and write elegant, beautiful programs. Now you can get in on the action as well.

This book describes metaprogramming as an essential component of Ruby. Once you understand the principles of Ruby, including the object model, scopes, and eigenclasses, y...more
Paperback, 296 pages
Published February 22nd 2010 by Pragmatic Bookshelf (first published 2010)
more details... edit details

Friend Reviews

To see what your friends thought of this book, please sign up.

Community Reviews

(showing 1-30 of 537)
filter  |  sort: default (?)  |  rating details
Tamara Temple
Paolo Perrotta's Metaprogramming Ruby: Program Like the Ruby Pros is a tour de force on Ruby's Object Model. The book goes into considerable depth on how it works, and presents many examples of manipulating the object model to good use. The format of first section of the book goes through a week of a pair of Ruby programmers as they try to fix and refactor an existing application, and how they use various metaprogramming "spells" (techniques, idioms, etc). The second section is a set of essays t...more
Pauli
The author creates a continuing story as a framework around which to present the material. I found the narrative annoying, and therefore distracting, so much so that I had to abandon reading it after the second chapter.

However, material presented is sound, if you can get past the cutesy presentation. Otherwise Russ Olsen covers metaprogramming in ruby well in Eloquent Ruby - highly recommended.
Michael
Before anything else, I have to say I really didn't like the style the author chose for the first part of the book. In the chapters named "Monday" to "Friday", you go through your first week in a new job, doing pair programming with your colleague "Bill". While this is fun for about half a page, sentences like "Bill walks over to the whiteboard and starts drawing a blablabla" get old fast. Very fast. I'm not exactly sure why the author decided on this style, since in my opinion it doesn't add an...more
Alex
This is a book fills a long-standing whole in the Ruby community by laying out a cohesive explanation of the Dark Art we call "meta-programming". So much of Ruby metaprogramming is tribal knowledge and it can be difficult to acquire. Even more difficult is understanding the underlying rationale for various bits of meta-magic. This book does a good job of boiling down Ruby metaprogramming into a list of "spells", then explains each one in the context of a running narrative.

For any Ruby programmin...more
Andrew Nicholson
Every Ruby developer should read this book, if only to learn some of the depths of what is possible in the language, and how the ideas from different paradigms (OO, message-passing, FP) can come together with such power.

The book is conversational in tone, and the idea of "spells" discussed throughout provide helpful mnemonics to recognize the concepts in the wild later.

I read this after attempting to write Rails plugins; a lot of what seemed quite unusual to me (or sensible, if a bit quirky) now...more
David Workman
'Metaprogramming Ruby' is one of the books that has been taking the ruby programming community by force, and it is easy to see why. Metaprogramming has been espoused for quite some time as one of the most compelling features of the language, and for a lot of newcomers to the language it seems a complicated and arcane subject reserved for those who really know the hows and whys of programming in Ruby. A book that provides insights into this subject is destined for the bookshelves of rubyists ever...more
Graham
Metaprogramming Ruby is by far my favorite Ruby book. First, it does not treat the reader as a brand new programmer. The basics of Ruby are obvious to anyone that has programmed before, and can be picked up as examples are given. Thankfully this is not included in this book. What is included are the main differences between Ruby and other object-oriented languages such as Java, Python, and C++. This is an area which most other Ruby books completely lack.

If you are curious how Ruby pulls off it'...more
Marshall
It's an impressive book that can turn an advanced programming topic like metaprogramming--which is often considered the black magic of programming--into something accessible and even easy. This book mostly pulled that off, but the way it did so was annoying: it's written as a stupid, contrived conversation between two programmers, as they learn metaprogramming.

The bizarre thing is that the second part of this book simply dumps you into the dark depths of Rails code, though accompanied by readabl...more
Michael
The first half of the book employs a 2nd-person narrative point of view that takes some getting used to. I would have disliked it more has I not been forewarned by other reviewers. Though tedious at first, ultimately I think it worked well to present concepts that are then studied in real world applications in the second half of the book.
Leo Gallucci
I didn't read this book, I actually studied it!
If you consider yourself Senior on Ruby this book should be a recap on what you already know and some new tricks will get to you.
If you are a Ruby newcomer then meta-programming is a must know if you want to become a decent rubyist and this book is an easy way to start getting there.

I compiled a few quizzes mostly out of this book like i usually do:
https://gist.github.com/4221679
Joshua Baker
Feb 09, 2011 Joshua Baker rated it 5 of 5 stars Recommends it for: ruby programmers
High-level and conceptual, but also idiomatic and filled with examples. Exactly the way I like my programming books. This was an excellent read because you're dealing with hands-on Ruby code on just about every page, so you never lose sight of the engineering, but the lesson is all science.
Davinici
Mar 14, 2012 Davinici rated it 4 of 5 stars
Shelves: it
Good book on meta programming. The writing style starts of kind of quirky as a dialogue between an old experienced programmer and his apprentice. This quickly got old for me though, whilst it reads easily it is a longhand form of getting ideas across, and makes it harder to skim content.

The second part of the book, examines portions of the rails source code, namely activerecord.
Will
Mar 10, 2012 Will rated it 4 of 5 stars
Shelves: tech
I really enjoyed this book. There are a lot of great tip and tools to learn from it as well as concrete examples. There is also a great recap of the "Spells" learned along the way in the Appendix. Which will be handy when one needs to recap an technique.
Aakash Agrawal
An awesome book for those who have already wet there feet in ruby and are now itching to expand their knowledge. It not only teaches you metaprogramming, but the innards of ruby itself. As the author puts it, "Metaprogramming is everywhere in Ruby".
Ibrahim
This is the most comprehensive resource I have seen on Metaprogramming in Ruby. Its easy to read for a more advanced topic. Explains how a number of great Ruby gems work. I feel I am a way more capable Ruby Programmer after reading it.
Brian
(4.0) Pretty good resource

Most valuable part for me was just walking through the ruby object model in a structured way (rather than just poking at it to learn in irb). Then the metaprogramming concepts build well on top of that. I definitely learned a lot. Though I think it should be emphasized more that metaprogramming can create more problems than it solves and should be looked as an option (vs. writing a bunch more code that's more clear). I'll probably refer back to it when developing gems a...more
Dominik Liebler
For the advanced Ruby programmer only. You should have some experience with Ruby and ideally with other languages too, to really value what is possible with meta programming in Ruby and to enjoy this book!
Augusto
Really good introduction to the metaprogramming capabilities of Ruby. It's quite an easy read as the author wrote the book as a conversation between two developers (this is taken a bit to the extreme in a few places of the book).

I think this is an excellent book for someone who doesn't have any background on the metaprogramming features of ruby.
Akeem Adeniji
This book is a must read for any software developer writing code in Ruby. It provides valuable information regarding the structure of Ruby's object model. The techniques presented in this book with change your approach to implementing solutions regardless of language.
Fredrik
Insightful, entertaining and pragmatic. A good and straightforward introduction to metaprogramming. The structure/format was enjoyable.
Sergey Avseyev
Отличная книжка, которая помогла систематизировать текущие знания.
John Woods
This book was really helpful in moving me to the next level of Ruby programming. It's got some great examples.
Paul Barry
Excellent book, gives clear, practical examples of how you can use metaprogramming in Ruby to make better programs
Long Nguyen
The book was ok. I skimmed through it a lot to find the real content
Said A
A must read for any Ruby programmer!
It gives you an overview of the object model in the first couple of chapters and suddenly every single line of code that didn't make much sense in popular libraries is clear as an A class diamond :)
Pete Morgan
Great book showcasing many of ruby's strengths.
Jacob_ninja
This book actually keeps your attention
Minger
Must read. 'Nuff said.
zhao
pure gold
Felix
This should definitely be your second book after learning the basics of learning Ruby.
« previous 1 3 4 5 6 7 8 9 17 18 next »
There are no discussion topics on this book yet. Be the first to start one »
Metaprogramming Ruby: Program Like the Ruby Pros (ebook)

Goodreads is hiring!

If you like books and love to build cool products, we may be looking for you.
Learn more »
Metapuroguramingu Rubī

Share This Book

Your website
“Don't you just love self-referential logic?” 1 person liked it
More quotes…