Hi --
Im a C# programmer and Im totally new to Ruby.
What would you guys say is the main benefits of Ruby over C#?
C# has closures and is getting lambdas in C#3
So in what scenarios should I absolutely go for Ruby instead of C#?
One of the benefits that I've found myself is the reflection/runtime
modification support.
When I implemented my .NET AOP lib NAspect in .NET it took a few good
months to make it work.
In Ruby it took me about 5h to get support for pointcuts, interceptors
and the whole kit.
So that part was pretty amazing.
but are there any other areas where ruby really shines, or are all of
the goodies related to the abillity to modify things on the fly?
Definitely the former. But I can't enumerate things about Ruby that
you're going to like; you have to try it out, and see whether it
speaks to you.
I can, however, enumerate some things that I like
Perhaps above all, the clean, expressive syntax. There's relatively
little punctuation; well-written Ruby code has a sparse look that I,
and a lot of other people, love, and it manages to be terse without
being cryptic. (Badly-written or [Java/C/Perl/...]-like Ruby code,
does not have these qualities
I also like the code block/iterator facility, whereby a method call
can include a code block as well as an argument list. And I like
'yield'. I know there's a vogue for doing:
def meth(a,b,c,&block)
&block.call
instead of using yield, but I find that yield gives me more of a sense
of a kind of hand-off to the code block, and therefore puts weight on
the code block as a syntactic construct in a way that make sense.
I love the way Ruby builds on simple principles, and has a kind of
mid-level range of "features" that are actually not language-level but
can sort of masquerade as language-level for the benefit of people who
want them. This happens already with class methods and attributes,
both of which are things that people seem to expect, and which can be
layered on top of the design of Ruby very easily without adding
anything at the language level.
One of the things that intrigues me about Ruby is whether there are
cases where some previously unheard-of features could be implemented
this way. In other words, if Ruby is so good at whipping up class
methods from the singleton method architecture, and attributes from a
mixture of instance variables and methods, what else might be whipped
up, including things that are not expressions of traditional OO
programming components?
This is also why I tend to react negatively to most suggestions that
involve fixing this kind of feature permanently and irrevocably in the
language.
Anyway, that's a few early AM thoughts, as I prepare to leave my hotel
room and help run the first official International Rails Conference.
There are, or will be, 550 Rails developers here -- and more
conferences and user group meetings and publications and chat of every
conceivable sort to come in the coming weeks, months, and years. And
*that* is what I *really* love about Ruby.
David
···
On Thu, 22 Jun 2006, Roger Johansson wrote:
--
David A. Black (dblack@wobblini.net)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)
See what the readers are saying about "Ruby for Rails"!