Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What language features of Ruby would you highlight compared to C#?

I am giving a series of talks to a .NET (C#) development team on the Ruby language and environment. I am approaching it as an opportunity to highlight the benefits of Ruby over C#. At first, I want to concentrate on the language itself before moving into the environment (RoR vs ASP MVC, etc). What features of the Ruby language would you cover?

like image 722
jsmorris Avatar asked Feb 23 '09 21:02

jsmorris


1 Answers

I gave a talk to a .NET user group a while ago about IronRuby, and faced similar problems. The things I focused on were:

  • Duck typing. There's nothing stupider than List<string> stringList = new List<string>();

  • Expressive and Concise syntax. Simple things like leaving out parentheses, array and hash literals, etc. (combined with duck typing, you get string_list = [] which is obviously nicer). All small things which add up in a big way.

  • Metaprogramming. Starting with simple things like attr_accessor, then maybe something a bit more advanced if they don't immediately see the benefits. Don't try and compare things to lisp and wax on about programs writing other programs... people will just think you are smoking something. Stay simple and hammer home the point that you don't have to keep writing the same crappy boilerplate code anymore

  • As a good "finale", show them some normal NUnit style tests with all the mess of Assert.NotEqual<string> blah that they usually have, then say "here's the same code written in ruby" and show them it written using rspec (it will be half the length and 10 times easier to read... if that doesn't sell them, nothing will).

like image 122
Orion Edwards Avatar answered Sep 21 '22 22:09

Orion Edwards