Re: Not quite getting it

This was a really excellent reply regarding the ruby ‘feel’.

Saving this one.
Sorry for the toppost.

Jamie McLaughlin
SAIC
Office: 703-292-6307
Mobile: 571-263-2528

----- Original Message -----
From: [email protected] [email protected]
To: ruby-talk ML [email protected]
Sent: Sat May 17 02:43:37 2008
Subject: Re: Not quite getting it.

Roger A. wrote:

So is it common practise to do it like this?

I wouldn’t really say it’s “common practice” in Ruby to do a bunch of
kind_of? parameter checks; I haven’t seen it very often, and if it were
the “desirable” thing for a Rubyist to do, the language would do it for
you. As you say, this way adds extra steps just to check some stuff that
only ultimately has the result of increasing the coupling of your code.

Instead, look at it like this: how likely is a Giraffe able to do what
an Order does? If the Giraffe doesn’t quack like an Order, than an
exception is going to be thrown automatically anyway.

Just program in it, and see how often it ever actually bites you. Start
with small things, work your way up. Read other people’s code from time
to time. I myself am from a C# background, and probably I really still
think that way, but I do like Ruby a lot and I find it fun to use even
though my Ruby code doesn’t look as “Ruby” as many of the people’s here.

And do keep in mind that Ruby makes some things quite simple that can be
more of a pain to do in C# – anything involving string manipulation and
regular expressions, for example. And the built-in arrays and hashes
have a ton of functionality and make stuff really succinct (and gets you
away from having to use long nested List<Dictionary<string, Blah>>
stuff, or having to cast all the time with ArrayLists, or whatever). The
language reads well and makes you jump through minimal hoops; the code
you write tends to be shorter and thus easier to digest. It has an
interactive mode that’s really neat, and you can even use it to check
out what methods a given object makes available. The “standard library”
is rich and has a ton of stuff built in. And there’s a lot of
high-quality, free libraries and tools out there that other people have
done.

Where C# trumps it, in my opinion, is in having a ridiculously awesome
IDE integrated with it, and in super easy GUI building capabilities.
(There are other more obvious differences, like performance vs.
cross-platform capabilities.) There are of course Ruby IDEs (including
the SapphireSteel Visual Studio thing or whatever that has Intellisense;
I’m sure the guy will be happy to plug it) and you can of course build
GUIs in Ruby, but again, it’s not about what a language can DO, it’s
about what it makes easy.

So again, just give it a whirl. Outside of whatever your work uses,
there’s no one forcing you to use one language or another. Try them out,
keep an open mind, and go with what feels good.

Posted via http://www.ruby-forum.com/.