From: Jari Williamsson Date: 2008-01-18T04:35:58+09:00 Subject: Re: Properly using Ruby's specialness J. Cooper wrote: > I was recently reading a presentation on "10 things Java programmers > should know about Ruby." Like many similar discourses, it talked about > classes being objects and singleton methods etc. etc. Now, I am familiar > with these different things, but I think I am too stupid to discern > their inherent worth. > > 1. Open classes. The other day, in a little Blackjack game I wrote in > Ruby, I used this feature to add in a method to the Array class instead > of making a class that inherited from Array and added that method. > However, a) I'm not sure if that was the "right" way and b) I'm not sure > if there is an advantage to that approach over the latter, per se. > > 2. Singleton methods. I really can't think of a particular example where > I would use this... please help! > > 3. Blocks. Although now (after some practice and getting used to) these > make sense to me when I use them with methods already designed, I don't > think I have internalized them to the point where I would write my own > methods that accepted them and worked with them. Has anyone else been in > the same boat, or do they usually just "click"? > > Thank you and sorry for the noobness, It seems like you want to read the book "Design Patterns in Ruby". It goes into great detail when to use what, and why, and such stuff. Best regards, Jari Williamsson