tags:

views:

292

answers:

10

I am curious about Ruby. Up to this point I have been following the whole C/C++/C# path and feel the need to branch out. Are there any references on how to get started and how it differs from other languages?

+1  A: 

This try ruby in your browser demo is a little bit on the basic side, but it's good for a nice quick introduction to the language for someone that hasn't used it or read much about it already

John
+1  A: 

Since C# is close to Java, you could probably piggyback on the several "Ruby for Java programmers" articles out there; this JavaWorld article seems pretty good.

I'm also in your boat (Java and C#, starting up with Ruby), and I just started reading the Pickaxe book ("Programming Ruby: The Pragmatic Programmer's Guide"). That was good enough to get me started with the language. However, I'd been eying Ruby from a distance for a few years, and knew a bit about what to expect; if you're brand new to the language then you might have a harder time with it.

In my view, there's only 4 things that are really different in Ruby compared to Java/C#:

  1. Blocks/closures (and that's only new to Java; C# has delegates which are the same thing)
  2. Dynamic/Duck typing
  3. On-the-fly definition of classes
  4. "Keywords" are typically methods/functions, and can be redefined for interesting results (especially when defining classes)

The rest was fairly standard Object-Oriented Programming practices, and learning a completely new standard library.

Craig Walker
+4  A: 

Check out the series at CodeThinked about programming Ruby from a C# perspective. It is a really good series and I recommend it for any C# developer looking to learn Ruby

Rob Bazinet
A: 

I like Why's (Poignant) Guide to Ruby, but you have to like his kind of humor.

Adam Hughes
A: 

Kanook: I would add to your list that classes, integers, nil just about anything are full-fledged objects, which particularly in combination with your mentioned blocks makes for some rather unusual (and arguably clever) constructs like 5.times or 1.upto(10) do {|x| puts x}.

Playing with irb also helps a great deal with learning by trying out code.

Sören Kuklau
+2  A: 

There are many things that were different for me. I came from C/C++ (no C#) and some Java. The blocks was the biggest thing that gave me issues (and to some extent still does). The other big thing for me is something that I haven't really seen mentioned, and perhaps it's because I'm slower than most, but the "#{some_var}" construct. The #{} operator assists variables in translating to strings, but what used to throw me off was the '#' making me think that there were comments strewn about all over the code I was reading.

Also check out: http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/

salt.racer
+1  A: 

If you like a "learning by doing" approach, you should take a look at Brian Marick's Everyday Scripting with Ruby: For Teams, Testers, and You . It combines well-written reference material with four useful and illustrative projects. (See the table of contents here.)

McKenzieG1
A: 

As a CSharper, I found RailsSpace to be an incredible tutorial. The only assumption is that you know something about web development. The book is a completely hands-on experience and covers all the basics on more. Even better, it has you up and writing code in just a matter of minutes.

Brad Tutterow
A: 
domgblackwell
A: 

Ruby on Rails for Microsoft Developers by Antonio Cangiano might also address your situation very well. I guess it depends on whether you want to learn Rails. I'm pretty sure there's a good intro to Ruby in the book, however.

webmat