Ruby lets you hook in and see (and change!) a lot of behavior of the core language. Methods, constants, classes, variables… Ruby lets you query them all, and change a lot about them.
These are just hooks – things Ruby calls in response to something happening. That’s different from, say, all the methods you can call to find our what’s defined and how – like instance variables, or method bindings, or…
Here’s summaries and links for all the hooks I could find (thanks to Google and StackOverflow!):
There’s a semi-famous book, The Art of the Metaobject Protocol by Kiczales, des Rivieres and Bobrow. Alan Kay, the guy who invented SmallTalk and the phrase “Object Oriented”, called it the best book in ten years.
But it’s takes some describing.
You know how Ruby has a class called “Class”? And how all classes are instances of it? And how Class is a subclass of Module?
The Metaobject protocol asks, “what if there were more subclasses of Class? And you could make classes from them, instead of plain old Class?”
Also, it includes what we’d now call introspection functions – they didn’t usually call it that twenty years ago when this was published.
But what, specifically, does that mean?
Five minutes on the Internet will find you somebody who thinks Ruby shouldn’t exist and is clearly inferior (try it!). Or pick a big tech company, especially an “Enterprise” company. Same thing – you’ll find a Ruby-hater in five minutes if you’re actually trying.
If Rubyists keep doing the right thing, this will be true forever. Let me explain.
There’s a set of things Ruby is really good at. I’ll list some of them:
There are some other things Ruby is “good” at. Like, it’s good at them but many people think they’re a bad idea. I’ll list some of those, too:
Ruby and Python, so similar and so different. By which I mean, “the languages let you do the same things in most of the same ways, but the communities are utterly different.”
Ruby, like Perl, says...
A reader asked me for quick recommendations on writing clean code. Here’s what I wrote back:
Clean code can be a number of things. For instance, a classmate of mine named Jim Gay likes a pattern called DCI for separation of concerns, and wrote a book about it (http://clean-ruby.com/).
This idea was rejected by GoGaRuCo (link to part one) as a talk. So you get to see it on this blog!
Quick summary: I’ve got a thing with a background thread. Clearly the code could have things go wrong. Oh Jeebus, how do I test it?
You can check out Hastur’s Ruby client as an example here – it has...
I proposed a talk for the Golden Gate Ruby Conference, and got turned down. Usually that’s it, but the excellent and classy Josh Susser offered to say why he’d turned people down (woot!). He said:
I think we had a good idea of what your talk would be about. But this year we are a bit tired of testing...