My Love/Hate Relationship with Ruby on Rails

I love Ruby as a programming language. I first discovered Ruby after having been a Java developer for almost a decade. This was long before Java introduced closures so Ruby’s blocks and iterator methods like #each and #map were a fierce novelty and created a developer experience that I had never felt before except in academic languages like Haskel. Mixins were a dream come true. (Java has started to catch up in this regard but it feels shoe-horned and awkward for the sake of backwards compatibility.)

After working almost exclusively in a variety of full stack Ruby applications for almost six years, the honeymoon has long since come to an end. I miss type safety. Ruby’s duck typing is both a blessing and a curse. It’s a blessing because it lets you do things you feel like you wouldn’t be able to do in a statically typed language and it gets you out of a bind. The curse comes in when you begin to onboard junior developers in a long standing application and they write methods that return a complex type in one path and a string in another. It can be a lengthy process to explain why this is a bad idea. Ruby’s other weaknesses are shared by other scripting language (the lack of a compiler prevents detecting mismatched method names, function arity, and mistyped variables before runtime).

What are the other options?

C#/.NET

I have no idea how far non-Windows support has gotten in the past few years. Last time I checked it out it felt pre-alpha even. Running a Windows machine for development has no appeal for me – even though I’m sure Azure would make .NET a very appealing option.

Java

Still has a long way to go to keep up with modern languages and doesn’t have any frameworks I’m aware of that have any sex appeal what so ever… Well except for my baby, Hex. Spring is cool… but so 2005.

I acknowledge my views on Spring are incredibly ignorant and I need to research modern Spring to properly evaluate.

Go

I love Golang. I don’t have enough experience with any of the existing web frameworks to make a call on what a good conglomeration of full stack frameworks looks like. Which brings me to…

Why is Rails so Damned Appealing?

Opinions

Every time I start to think I want to build a complex application in Go I start to research different web frameworks, ORM frameworks, and I’m not even sure if that covers everything you need. Does the web framework come with a comprehensive templating engine? With Rails all it takes is one CLI command and you have a fully functional, fully configured full-stack web application to get busy with. How much would it take to get a Golang meta-framework to this level? The Rails bootstrapping process has made me very lazy over the past few years and I’ve developed a pretty low tolerance for anything that takes longer than typing a few templating commands.

Auto Loading

Make a change, refresh, change is applied. Rails lets you rapidly iterate in development. In my Java days the only things that automatically reloaded were JSPs. SOMETIMES you could get away with method hot swapping as long as the signature of a class or method did not change. How many hours did I waste waiting for my code to recompile and for Tomcat to reboot the context? I believe other statically typed platforms have a solution for this but the Golang community doesn’t seem to have found a solution for it yet. (Auto-running unit tests and the speed at which they run comes very close to making up for it in certain projects.)

Is it time to branch out?

It’s probably been said before – Ruby on Rails is great for rapidly prototyping new projects. At what point do you decide it is time to re-write in a more sustainable environment? How many users have adopted your project in order for you to commit to moving forward? How long are you willing to forego writing new features for the sake of long term stability? The longer you wait the harder it is to rip off the bandaid. If you do it too early you run the risk of doubling down on the investment with too little traction to recoup the cost.

Ruby is an incredibly enjoyable language to work in. Rails is a great framework that allows new team members to jump in and be productive right away (the opinions provide a solid way to know where to find what code when updating/adding features). These qualities make Ruby on Rails a very appetizing option for starting new projects. However it has some fairly blatant weaknesses that can be felt the longer a project lives on. Can statically typed languages compete with the rapid prototype capabilities that come with Ruby and other scripting languages?