|September 24, 2016

Daily Archives: September 24, 2016


Switching from C# to Ruby

Published by:

In March 2016 i switched jobs leaving Progress and joining Receipt Bank. So i had to switch the whole tech stack. In Progress my hands were mainly busy with C#, Web API, Visual Studio, MS SQL, MSMQ and the rest of the MS technologies. In Receipt Bank i we use Ruby (mainly) with Rails as a Web framework. I never actually wanted to switch but it happened this way – i liked the company and had to.

Changing the language is easy. Changing the stack and the tools is not.

When you are a more seasoned programmer, you should be able to switch pain-free. Well, it depends. If you switch from C# to Java or from Ruby to Python it should be fairly easy. It is not that easy if you switch from C# to Ruby as it is not only the language that you will have to learn. You will probably have to drop Windows and adopt Linux or OSX. You will probably have to switch from IDE as VS to a text editor as Sublime, Vim etc. You will most probably use PostgreSQL or MySQL instead of MSSQL. The database change is not that dramatic as the later two being SQL, they share a lot in common with MSSQL. However, dropping the beloved IDE in favor for a text editor is a pain, at least in the beginning. You quickly realise that you may be as productive with a text editor as with an IDE. A power Vim user is at least as productive as a power VS user. The OS change is kind of a dramatic also. I started using OSX and felt great pain in the beginning. Most of my time was in the console which is quite contrary to the Windows experience. However, when you get used to the almighty console, you never look back.

How is the language different?

#1 Ruby is interpreted and C# is compiled. So in Ruby everything is just working hit a problem. C# compiler will complain during compile time if your code is no good.
#2 C# has static typing and Ruby does not. This is not one sided though. Matz (Ruby creator) said that some typing is coming in Ruby 3 and C# introduced var and dynamic to provide for more flexibility. However, the general picture is that Ruby is interested in behaviour and not static properties. This gives great flexibility and i find this rather liberating. To avoid shoot-in-the-leg situations, you have to have very high test coverage with flexible types.
#3 Testing. Flexible languages as Ruby provide for much better testing than C#. In C# you often have one interface with one implementation class which i find stupid. However, you have to do that so you can mock that class in tests. If Ruby you mock pretty everything easily and don’t really need interfaces (there aren’t any also:) ).
#4 Functional programming has much deeper roots in Ruby. C# has made big steps also with LINQ but Ruby is superior in this domain, especially when working with collections.
#5 Ruby has a very powerful feature called blocks. These are like callbacks to functions and are really powerful. There is hardly a class that you can’t find blocks.
#6 Syntax. Ruby is much more minimalistic than C#. Syntax is weird in the beginning but you soon start to love it. Little parens are required and there is no return statement. You can single line a lot of stuff to make code more concise. Syntax is important to write readable code and Ruby definitely has the syntax for that.

What else

I would say that the ruby community is much more vibrant than the C# one. Ruby was created with developer’s happiness as a main goal and developers love it. Ruby is religion for some. Matz is accepted as a rock star in the community. There is nothing like that with the MS technologies. ¬†Giving back to the community is a law for many. That’s why you will find many Ruby developers spend time coaching and teaching others for free. They also contribute to open source big time.

True Ruby developers are committed to quality very much. They also keep code clean and neat with great care. Code must not only work but be beautiful. Fellow developers are very fast to growl if you put one extra coma somewhere. Most of the C# developers i have seen are a bit messy. Quality is also appreciated but readability and code beauty not that much. As i said happiness is a founding principle for the language and you can tell that.

C# is preferred by corporations and Ruby by start ups. So choosing the language will have impact on the company that you will be working in.


I find switching to Ruby a huge win. Despite the pain in the beginning, the language is very elegant and powerful. There are enough good tools also out there to get the job done. The biggest advantage however is the community. Being part of that is guaranteed to higher your level.