From: Rick DeNatale Date: 2006-09-01T02:52:45+09:00 Subject: Re: Ruby Books On 8/31/06, Matt Todd wrote: > Hi, I'm surprised nobody's mentioned it yet, but, _Why's Poignant > Guide to Ruby (http://www.poignantguide.net/) is an excellent, free, > trippy resource for going over the fundamentals of Ruby. It's not > finished yet, unfortunately, but it covers a great deal, and in a very > entertaining way, too. _Why's writing style is unique and quite > entertaining considering it's a programming book. If you can read > through it, it's a great way to get introduced to the language. It was > my first introduction to Ruby. I enjoy it, but... I've got a few quibbles with some of why's terminology, which may lead the unaware off track. For example in the "Parts of speech chapter" which occurs fairly soon: http://www.poignantguide.net/ruby/chapter-3.html#section2 he says: " front_door.open In the above, open is the method. It is the action, the verb. " Well, open here isn't really a method, it's a name which is used to find a particular method. It gets turned into the symbol :open, then a search is done for a method which is associated with that symbol, starting with the (singleton) class of the object referenced by front_door, and proceeding up the superclass chain. So it's a verb, but it's not really an action, 'sit' is a verb, but it produces very different actions depending on whether it's said to a person, a dog, a robot, or something else. Now this might be getting into a little too much detail at this stage of an introduction to Ruby, but the lack of a separation between a method call, and the method itself troubles me. The Pickaxe DOES make this distinction on the second page of the chapter which starts discussing Ruby programming. It might seem a minor point, but to my mind it's this separation which is the hallmark of object-orientation as Alan Kay first defined it, and Ruby practices it. There doesn't seem to be an official Ruby name for the name of a requested method. In Smalltalk we call it a message selector. The Pickaxe borrows terminology from Smalltalk, distinguishing messages and methods. Dave's use in the pickaxe might be considered informal by some, but the RDoc hints at this as well. * Object#method - "looks up the named method in obj" * Object#method_missing - is "invoked by Ruby when obj is sent a message it cannot handle, and args are any arguments that were passed to it. * Object#send - "invokes the method identified by symbol, passing it any arguments and block." It looks a lot like Smalltalk semantics to me. The only real difference is that Smalltalk actually has a Message class which gets instantiated when it's needed, such as for the argument to the doesNotUnderstand: message which corresponds to Ruby's method_missing. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/