Monday, March 12, 2012

Ruby vs. C#

I've been working with C# on the day job and Ruby on a side project. Shifting between the two has been enlightening.

C# is a statically typed language; Ruby is dynamically typed. I have come to rely on statically typed definitions, so I am a decent coder in C#.

I find that the coding experience in Ruby is quite different. I cannot rely on the IDE to tell me when I have assigned an improper value - in Ruby one can assign anything to any variable. It is easy to forget the type of variable and assign the wrong thing; I find out only at runtime, usually with an error of "undefined  method (methodname) for (classname)".

To get things right in Ruby, I must be more disciplined in my thoughts and in my programming. I'm not sure that this is a bad thing... I'm also not sure that this is a good thing. At the moment, I know only that it is a different way to program.

1 comment:

  1. I know this is back from March and whatnot. With 20/20 hindsight though, how do you feel? I've been a .NET/C# (WebForms) guy for years, but have recently moved into MVC, and Ruby (on Rails) has snagged my interest. I plan to learn/use both when appropriate, but, put in a "you're deserted on an island and you can only bring one" situation, what would you choose now?

    Ruby or C#?

    ReplyDelete