What I dislike about Ruby on Rails

Posted on Feb 8, 2021

Ruby on Rails is a powerful and graceful web framework. It is well thought out, the best structured web framework I have used, and favors convention over configuration. The learning curve, however, is steep and coming up to speed on projects is slow.

This is because pattern recognition is difficult in Ruby and Rails. For example if you have a config.yml file in the config/ folder in Rails you reference it by Rails.application.config_for('config'). Looking at the code this makes sense, but if I found that in the code without knowing Rails I would not immediately know to go to config/config.yml, whereas if the path and file name were in the reference it would be much clearer.

Similarly Rails does not require imports, so it is hard to know where code is coming from. Is it a built in class? Is it a service? Is it a gem?

Further you can omit characters. For example, if you are calling a function without any input parameters you can call it without parenthesis. This makes it look exactly like a variable reference.

Namespaces are another example. They are all written in snake case, but in the code they are all in camel case. This is not terribly hard to figure out, but instead of being able to recognize an exact match you have to fully read both.

This arguably makes writing code easier, or at least faster, but it makes reading code more difficult. In general I have found reading code harder than typing, so I prefer to require a little more typing for improved readability. It could be, though, that Rails is so well structured because it would be impossible to understand otherwise.