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.
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.
Singleton methods. I really can’t think of a particular example where
I would use this… please help!
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,