Andy Hansen

Home About RSS

My Transition from C# to Ruby

Late last year, I made the switch from C# to Ruby as my server-side language. I’ve put together some details of my experience for anyone thinking of doing the same.

From the IDE to the text editors

The C#/.NET development environment comes in a pretty standard package. You’ll probably be using Windows, and you’ll probably be using Visual Studio. Out of the box this gives you most of the tools you need. Code generation, code completion, error checking, and unit test runners.

Setups for Ruby/Rails are a lot more varied, most people seem to be using either Vim, VSCode, or Atom as a base. Unlike Visual Studio, your editor text editor won’t have all the bells and whistles out the gate. However, they each have a rich ecosystem of extensions to tweak them to your specific needs. I’ve found the process of building up my development environment to be a slow but rewarding process, with a bit of the IKEA effect sprinkled in for good measure.

The command-line also becomes core to your daily workflow, and you’ll find it used in even basic Ruby tutorials. Heavy use of the command-line can take a bit of getting used to, but will prove to be both a powerful and satisfying development tool.

Learning Ruby

A few months had passed before I really started feeling comfortable in Ruby. It sat firmly at the opposite end of my comfort zone, as a dynamic scripting language. My statically typed, compiled, safety net provided by C# was gone.

Now that I’ve got more of a handle on the language, I’m starting to feel the benefit of it’s flexibility. It’s a lot easier to test an idea, and the code is putty in your hands as you try different variations of the same thought. Compile time is gone, which is especially handy on larger projects where even the smallest change could involve an intolerably long wait. A few compile-like checks can be gained back with static code analysis tools like Rubocop. These will pick up low hanging errors like unused variables, and help you catch mistakes as early as possible.

Ruby also comes with some interesting language tools, such as symbols, and shorthand if statements. It doesn’t look like much, but the combination of many little tools like these can make code very pleasant to write.

Debugging has taken some getting used to, but I’ve finally got a pretty good debugging setup with VSCode. There are also some great tools like Pry, which gives you a developer console wherever you put binding.pry in your code.

The Ruby community is fantastic

I believe the major strength of Ruby is in it’s community. Events like RailsBridge and Railsn00bs provide a supportive environment to learn how to program. The New Zealand Ruby Slack channel as also proved to be an extremely valuable resource. Feeling connected to such a knowledgable community has inspired me to become a better programmer than I’ve ever been before, and this supportive combination of elements makes it an excellent place to start as a new programmer.

Time away from the Microsoft ecosystem

Microsoft does a great job at gluing all their offerings together, but this often means that it’s all you end up using. Your database is probably SQL Server, and your site is probably hosted on Azure. Thinking of trying bots? Well the Microsoft’s Bot Framework is right there. Don’t get me wrong, these are all great products, but I was starting to feel like Microsoft is all I knew. I could see the thriving world of open source through my window, and I had major FOMO.

Switching to Ruby was a chance to see just how green this other grass was. Both Rails, and Ruby are open source, and leverage open source technologies such as PostgreSQL. Occasionally I’ll bump into an integration issue, but for now the beaten path has been kind to a newcomer like me.

Will I be back?

During my stay in Ruby land, Microsoft has continued to improve their commitment to open source. Their new version of .NET, .NET Core is open source, and can even be setup on any platform. I still really love C#/.NET, and plan to pick it up for a side project at some stage in the future, but I’ll be trying my best to keep the stack as open source as possible.

Until then, I’m absolutely loving Ruby, and the open source ecosystem that surrounds it. Even in this short time I’ve learned so much, and it’s amazing to have such a new world of technology to explore. I can absolutely recommend jumping over the fence to try it out, even if it’s just for a while.