4 ms·
Good points, and I certainly understand why the Ruby community is so passionate. The language is expressive, mutable, and has some nice syntax. My personal prob
by drchopchop 6y ago
Good points, and I certainly understand why the Ruby community is so passionate. The language is expressive, mutable, and has some nice syntax. My personal problems are:
- Rails is the monolith that gives you all of that auth/database/etc capability, and it's very non-trivial to upgrade
- Refactoring a large codebase with a dynamic, untyped language like Ruby is extremely difficult without 100% test coverage
- Unusual syntax conventions which can get you into trouble (y = x.blah vs x.blah!), strings vs symbols, magical naming conventions for Rails, etc etc
- Auto-loading is a mess
- ActiveRecord is great until you care about DB performance, and then you end up continually working around it's quirks (the N+1 problem, indexes failing due to int/string type conversion, etc)
- Everything in Rails is convention over configuration. File paths, names of classes, names of routes, mapping of AR to DB table, etc. Sure it "just works", but when it doesn't, it's not always easy to figure out why.
- Monkey-patching is cute, but, seriously? Hot-patching system library functions?
- What's a variable? What's an accessor? What's a function? Parentheses are optional, return is optional (yet @ is required for class/instance vars?)
Again, none of this prevents you from building a quick and easy CRUD app, but I've found the deeper I go, the less I like it.
- joshmn 6y agoYour points are valid. Understanding the quirks and features of Rails is a lot, too. It sounds like you had to dive head-first into a mess where it was hacked together by non-Rubyists who learned "just enough" to push to production, and were by no means diligent about following Rails conventions. Obviously, this issue is agnostic of what language one chooses. But it certainly leaves a bad taste when there's all this "magic" happening (see: metaprogramming). That magic is what makes working with Rails so productive. Rails makes it easy to do bad things because of how magical it is. `@post.comments.each { }` when you didn't preload `comments` is bad. This is fixed with `Post.includes(:comments)`. Similarly, if you avoid its conventions — overriding `table_name` on your model, in your example — and try work against it, rather than with it — it becomes more of a chore than it does a treat. Like all frameworks, they require a little bit of diligence and care and understanding to really get the full effect. Rails is great because it makes a lot of assumptions at the cost of brainpower, and for the vast majority of things this is good. It's not always the right tool, and it doesn't need to be. But when it is — again, a large majority of web apps are just CRUD — and when it's written with a little bit of care, it's great.
- tomc1985 6y agoI've been working with Ruby professionally for something like 10 years and all of those points are generally just things you learn to work around. And Rails itself is less monolithic than you think. You can swap out most of the components for other gems, like ActiveRecord vs. DataMapper (though I am not aware of anyone who does this anymore and the level of support for Rails gems generally outclasses everyone else) or remove those components entirely. Much of the "Rails magic" is inside ActiveSupport, which you can import without bringing in all of Rails proper. Personally I think much of the stuff in ActiveSupport should go core.
- block_dagger 6y agoThese issues could be applied to any modern language - I don't see them as specially affecting Ruby. As someone who has worked in many languages professionally for 20 years, Ruby/Rails is my favorite productivity tool for web apps, hands down. FYI see Zeitwerk gem for autoloading improvements.
- mekster 6y agoThe article mentions about the use of "refinement" that only monkey patches to your local scope and won't affect the rest of the codes. Also, type hinting is coming to ruby 3. > magical naming conventions for Rails That's rails' problem. I don't like it either but nothing to do with ruby. Seems like half your problem comes from rails.