I have been coding in Ruby for over ten years, and I have had a chance to see some real-life codebases created by in-house teams, contracts, and software houses of all skills.
Inexperienced folks that don’t have guardrails in the form of mentors can create stuff I have never dreamed of. In my nightmares, that is.
Ruby allows you to create all kinds of magic. If you want to shoot yourself in the face, it will gladly allow you to do so. The nature of Ruby - where every class can be open, anything can be redefined anywhere often makes change truly scary. Specifically in codebases where magic is abused to the limits.
On top of everything, Rails doesn’t force you to encapsulate anything. Shoving all business logic in the model, including random modules whenever you need them, calling the database in view helpers? We got you, bro. The Rails Way is great for a simple blog but crumbles very quickly in a real production system. When you don’t encapsulate logic, don’t set proper boundaries system becomes coupled, and suddenly one simple change feels like building a Martian Rover.
Even the most popular test framework -
rspec - with its ecosystem like
factory_bot sprinkles even more magic on top. Magic that can be very easily abused. Randomly defined hooks, shared examples scattered all over the test suite, cascading factories and DSL that is so easy to misuse.
There is no takeaway here. It just got me wondering if any kind of programming language could help avoid at least some of those traps. Maybe it’s time to give Rust another go, a language that promises to save developers from themselves :).