What I Like About Ruby Language
I’ve been reading “Programming Ruby: The Pragmatic Programmer’s Guide” for couple of days already and learnt some interesting facts about the language. As a Java programmer with several years of hard-core non-stop programming experience, I find it pretty amazing to see how new languages adapt to what we really need, not what the classics say.
First thing to notice is the iterators. Yes, this is a state of art! Now that I learnt how they work they look like a blessing. It’s so natural and in conjunction with the second feature — the code blocks — can do miracles.
Also I liked the way the property accessors and modifiers are declared. If you wish, you can write method bodies, if not — just tell
attr_reader :somefield and/or
attr_writer :somefield and you are done. It’s usually a pain in the neck to create holder-objects and wrap every of its hundred properties with accessor / modifier. Of course, modern IDEs provide convenient means of automating this task, but you still have to document these methods, don’t you?
Well, not too much so far. I’m still in the very beginning of the book as I have to work sometimes and, I suspect, we all do. But I continue reading and soon hope to come up with more thoughts and impressions.
BTW, I still has got no feeling that it can be a replacement for such languages as Java or C. What I’m not sure about yet is the performance of the interpreter. Does it comparable to what modern JVMs offer and how it’s comparable to the native code? Any personal experiences?