Hacker News new | ask | show | jobs
by jrochkind1 4681 days ago
While designed to make things easier for newcomers -- I think these features are actually some of the biggest culprits in making things _harder_ for newcomers, because they fail at so many edges, and when they do fail, there's so much magic going on that it's nearly impossible for a newcomer (or even an intermediate user!) to figure out what's going on and why.

I think the heavy emphasis on auto-loading was a mistake, that someone writing a new framework would be wise to learn from and not repeat.

The reloading in dev mode is HUGELY convenient, I have to admit so I have trouble calling it a mistake -- but is also a huge mess when it fails, and does not work under multi-threaded request dispatch. That latter will, I think, become an increasing problem as more people use multi-threaded request dispatch in Rails -- Rails4 has multi-threaded request dispatch on by defualt in production mode. But I think not in development mode, precisely because of the code-reloading problem. But I'm not sure diverging the dev and production environments (violating 12-factor, incidentally) is a good sustainable solution.

2 comments

I totally agree. And this is before we even consider what ubiquitous autoloading encourages us to do to our code in terms of coupling. Our classes are available everywhere, so the tendency to create many hard dependencies on a wide range of classes is very strong. Want to run a SQL query right in a view? Nothing stopping you. Want to instantiate a controller in a model so you can get at the path helpers? I will hunt you-- er, sorry, I mean, "nothing stopping you" (except your pride).

Like you, I find it very hard to rubbish the auto-reloading, but even this encourages bad habits, I think. Rather than write tests for the behaviour we just implemented, or the bug we just fixed, we hit F5. Didn't work? Change something, hit F5. This at least isn't really Rails' fault; it's our job as programmers to do the professional thing. But it does act as something of a siren call to the rocks of cowboy programming. And like you say, there are other, more insidious issues with divergent dev/production environments.

> While designed to make things easier for newcomers...

The idea that Rails was designed to be accessible to newcomers seems to be pervasive but I don't think that has every been a top priority for the project. The framework is described as "optimized for programmer happiness and sustainable productivity". It's great if this also leads to a design which is approachable for newcomers but I think it is a mistake to judge features as if that was the intent.