395 points · by aaronbrethorst · 10y ago · 132 comments
"@dhh this is just a bit too much https://github.com/rails/rails/blob/master/rails.gemspec#L28 … now every Rails install requires redis, eventmacine, celluloid and faye"
The result is that I'm learning Elixir/Phoenix and having the same reaction Dave Thomas describes in his new book, that is, finding anew the joy of programming.
Second, I find Rails to still be the most productive web framework. Removing every last bit of redundancy is nice, but it isn't going to save me that much. Maybe it'll save me a couple tens of MBs of disk space, and a couple of MBs of RAM per process. But if that costs me a few hours of work, it isn't worth it. Disk space costs next to nothing and RAM is cheap. Maybe optimizing that makes sense if you're Facebook, but most people are not.
Every time I use Node.js, Sinatra, etc I find myself wasting time around the most basic things, e.g. directory structures, database migrations, logging, etc.
I don't care about the disk space and RAM at all, but every additional C extension (like EventMachine) means one more dependency that can break when I update a) my OS or compiler, b) Ruby, c) Rubygems, d) Bundler or e) Rails. Most of these updates have to be installed immediately for security reasons. I absolutely love Ruby as a language, but with Rails I feel I spend half my time in the terminal, trying to fix `gem install` incantations just to keep things running :(
But of course it doesn't fit everyone needs.
For example, Node/NPM/Express/etc. all have a philosophy the opposite of Rails bloat, but often require more configuration, and solid knowledge of the underlying middleware.
The tradeoff between these two approaches is one many engineers need to make (e.g., the more recent Gulp vs WebPack has some similarities to this debate), and this is a common debate that will likely continue for years in the future. Pick whatever works best for your philosophy, your team, and the given project.
[1a] https://github.com/rails/actioncable/pull/28
The backend for ActiveSupport::Cache::Store is similarly interchangeable (memcached, disk, etc.)
I can see why adding a Redis dependency makes opinionated programmers grumpy, and I predict ActionCable supports other backends than Redis eventually.
Elixir and Phoenix may or may not last, that I don't know, but they are a joy to work with.
Microseconds I say, microseconds! :) in development!
But it seems to have made it into the beta as a gem dependency.
https://github.com/rails/rails/pull/22585#discussion_r475154...
Here's a few ways to avoid it: https://gist.github.com/nateberkopec/1184c81a92c10d84d779
I just hope that they resolved some of them. And Rails has always been a dependency soup, so I am not too surprised to see stuff piled onto the ever-growing list (I have nothing against Rails, I even use it, I'm just not too happy about the bloatyness).
[1]: https://github.com/rails/rails/blob/master/rails.gemspec#L28
AFAIK nodejs is already an optionial rails dependency for the asset pipeline.
Some will note that Node has had real-time for years, but with all due respect to the Node ecosystem, nothing in it (edit: I'm referring to server-side frameworks; I love Ember-CLI) is as nice for developer happiness and productivity as Django and Rails. The best practices that have taken years to be baked into these frameworks make it more difficult to bring in new functionality, but I feel more confident that when new features are implemented, they will be done right.
I feel that we are in a very transitional time for web development right now. This is a field with a pretty high rate of change in general, but every now and then, things change dramatically even by web programming standards, and we go through a period of technological uncertainty. The last time I remember feeling this way was the rise of object relational mappers, dependency injection, model view controller frameworks, and various tag libraries on the front end[1] in javaland. I remember from a previous HN discussion that there is a web counter measuring the number of days since the last javascript framework was released. I remember feeling the same way about struts, struts2, spring MVC, tiles, tapestry, JPA, hibernate, ibatis, spring DI, pico, guice, and so forth…
Interestingly, much of this didn't so much get resolved as swept aside - Ruby and Rails, Django, and a few other technologies "appeared" [1, again] at this moment. I do remember feeling extremely grateful for ruby and rails, because I had started to hate programming. It wasn't the Java verbosity that I objected- I rather enjoyed programming with servlets/jsp and jdbc + the java web cookbook, and I never minded data structures and algorithms in Java - it was the churn and incredible amount of complexity just to do simple things that made me unhappy. Rails got some bloat here and there, expand and consolidate, but I feel that it did accomplish its main goal, at least for me, which was that I felt happy and productive programming again.
Now, with the disruption of SPAs, we are clearly back in framework churn, and I'm not loving the model of writing the back end in rails-api and using a javascript front end. I may warm up to this as my knowledge of javascript increases (and I certainly never minded going outside rails and writing sql, so I can't really say I object to more than one language). I've done a bit of ember, and it seems heavy to me, I have to duplicate so much routing, model, persistence, data tier work (I'm a noob, I may be doing it wrong, fully possible). I don't like looking at javascript as much as I like looking at ruby. I also do remember feeling a bit frustrated with Rails in the beginning, before I understood it well enough to do an end-run around conventions, so like I said, I may really warm up to javascript frameworks. But I really like Ruby, and I'm very satisfied with Rails (and if not rails, sinatra or something like that would be fine too).
Like I said earlier, I studied a lot of java-based MVC/DI/ORM approaches and ended up going with something that I hadn't even considered (Rails). I do think that in these highly transitional periods, this tends to happen - that you are surprised by the solution that ends up working for you. At this point, it's getting so speculative that I'm not highly confident in predicting things, but I wouldn't be too surprised if the "isometric" transpiled languages (like ruby and opal) end up changing things dramatically (ie., just as I didn't end up "picking" a java-based MVC/DI/ORM approach, I may not end up picking a javascript framework, I may end up surprised by a new and different approach).
[1] I understand these weren't really "new" ideas, many of them (like a lot of CS) go back to the 1970s, but they hit the scene in that they became an issue in day to day development for ordinarliy up-to-date but not cutting edge web developers, the people who just wanted to get things done.
> I've done a bit of ember, and it seems heavy to me,
One thing about Ember: it's specifically for "ambitious" applications. The idea is that you're going to be building something which needs all those things, so it's better to have them in the framework, where best practices can be shared across projects. Once you've built out those features yourself, you've built a custom framework anyway.An interesting point about frameworks, generally: they have a constant overhead. So for smaller projects, the framework dominates the application, but as the application grows, the application will dominate the framework.
@steveklabnik Thanks for spearheading Rails-api! :)
Re: Ember being heavy; yes, it is a bit heavy but that has huge payoffs as your application grows.
Now, on the other hand, compared to Struts or Spring MVC, Hibernate, and Spring DI, Rails felt lightweight. But if you compare someone else's MVC framework, like Rails, to a database connection and a programming language that can write out a server response, it's going to feel a little heavy, and you're going to feel a bit lost at first, no matter how good it is.
It took me a while to get used to Rails even though I consider Rails to have a friendly learning curve. So I do want to be clear that I don't necessarily consider Ember to be "heavy" in the context of what Ember seeks to accomplish.
To me, the real issue here is that if I'm going the rails-api route, I will have to use something non-ruby on the client. And then the question becomes why not just use javascript on the server, too, with node.js? Honestly, my initial study and experimenting with node and express have been positive, but I don't like the idea of giving up on ruby, or that all these wonderful server-side languages are obsolete now because for the moment, javascript rules the browser. Nothing wrong with node.js, at all, for those who like it but I have trouble believing that all web development, server side as well as client side, slowly migrates over to javascript, and that python and ruby become legacy languages because, well, why use anything other than javascript?
At this point, I'm just repeating myself, but I'll restate my very tenuously held belief that isomorphic, transpiled languages will play a big role in the resurgence of non-javascript languages for full stack development.
I guess Rails is stodgy and old. Technology changes very frequently sometimes too frequently. Less than 2 years ago everyone was getting on the Angular bandwagon. Now the conversation I've been having with employers is "Yeah we've decided that React is going in a better direction so we're replacing it with React."
Think about all that wasted code and time learning how to use the new framework so you can get what out of it? A few more miliseconds performance? Better more visually pleasing syntax? Learning the new hot thing? Does anyone ever think about the Return on Investment (ROI) relationship between learning something new, how hard it will be to learn that new technology and then figure out what you are gaining from using this new thing? Once you spend all that time trying to scale the steep learning curve for Angular or Ember or whatever new tech comes down the pike do you ever wonder "what did we gain by learning this new technology? was it worth the trouble learning it? What benefit did it provide once you know how to use it?"
I guess Rails is getting long in the tooth, but for the most part it does what I need it to do. It's predictable, it's readable, it's organized, and best of all I'm just competent enough to use it. I've hit the wall trying to learn it and overcome most of the pitfalls and aggravations while using it. It's just blowing my mind how eager many programmers are always pursuing the next technology. I'm all for change but only if the change is worth the aggravation. I don't know if Rails 5 is a big improvement but really it's good enough for most of what I need it for.
I learned enough Elixir and Phoenix to be dangerous and built the same thing there in about 2 days with much, much better performance. I've been working on it since.
I don't see myself moving away from Rails for most things I write because it's just more mature and suits my style of coding. I disagree with the way the developers of Ecto (the database adapter for Phoenix) are approaching things, so if I have a web to database app, it's Rails all the way. (Their decisions aren't bad. I just don't like them and that's my problem, not theirs.)
But if I have to do anything that deals with the realtime web, I can't think of anything better than Phoenix. I'll get over my issues with the DB layer and get stuff done because Phoenix channels are awesomel
This is a long winded way of saying "you should really look into Phoenix." :)
If I could choose, I would take Ruby or Python over plain JS. But CoffeeScript makes the best parts of JS shine (an object is a hash/map) while making it far more beautiful by disposing of semicolons and unnecessary braces and parentheses. Indentation and arrow functions really make it a beautiful language. If you haven't already, you owe it to yourself to try Ember with CoffeeScript (and Emblem and indented Sass).
I always felt Rails' model layer is clunky compared to Django's. What is the definitive representation of my model? The validations in SomeModel < ActiveRecord::Base or what's automatically generated in schema.rb when I run migrations via Rake? In Django everything, including migrations (in simple cases), is derived from the classes in models.py. But I thought it would be worth it to persevere, due to the above-mentioned advantages.
Then I realized I could (and should) compile assets via Ember-CLI, and Django Rest Framework is just a pip install away. So the two main advantages of Rails disappeared, and switching back to Django became, for me, a no-brainer.
Edit: I also prefer Django's less magical approach. This may seem ironic given my love of Ember, but Ember's magic is easier for me to understand than that of Rails.
Similarly, Django Rest Framework has ModelSerializers and ModelViewSets which give you a lot of free functionality out-of-the-box precisely because Django's Model layer was designed with DRY in mind.
Basically it's a type system for models with the ability of defining new types. I wonder if it can be used also for plain Ruby objects but given the existence of tableless ActiveRecord gems, why not? https://github.com/softace/activerecord-tableless/
Maybe someday we won't have to write migrations anymore. Rails could maybe just diff the attributes and types given, and figure out the schema itself.
There are migrations that can take hours to complete in production. Examples: adding an index to a very large table or adding an element to an enum (I remember a customer of mine had this problem on a MySQL db a couple of years ago.) A DSL that makes clear you are modifying the db is a safeguard against those surprises. Just adding something like indexed: true to an attribute declaration would be dangerous. Furthermore rake migrate:up/down are more convenient than reverting a change to a model by checking out an older version. I believe that it's not impossible to do it, but it must be designed very carefully.
Maybe because of those reasons Phoenix, the Rails like web framework for Elixir, has migrations even if models declare the attributes of the tables in the database.
Glad to have an easier way to incorporate AR benefits without including one by one
Full disclosure: I help produce the events - but you did ask.
[edit: it's only touched upon about his lifestyle - it's far more about his recent talk about rewriting software from scratch]
http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.ht...
[1] http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.ht...
From what I've seen 5.0 should be on par with the 4.x upgrades, which is to say, not bad. YMMV of course.
FWIW, the memory and instrumentation improvements in Ruby 2.x alone are worth the massive effort to upgrade. Good luck!
Looks like a fairly painless upgrade according to http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.ht...
Why release a beta if it's just an alpha? All the features isn't there. Why have this [temp] milestone? https://github.com/rails/rails/milestones/5.0.0%20%5Btemp%5D
At the moment, it looks like the issue is solvable, and I have code that seems to solve it but still needs some refinement before I can submit a pull request about it.
I don't know what the Rails core team is planning about the feature, but considering how complex the whole thing is and how much there's still left to do, I'd guess that it won't make it to 5.0.
[1]: https://www.youtube.com/watch?v=B3gYklsN9uc&feature=youtu.be...
Just looking at the client examples for action cable; is CoffeeScript now the standard way of doing JavaScript in Rails?
- Rails needs something opinionated and "new" every so often to remain relevant.
- Workers, consultants, etc., benefit from being familiar with the latest rails, so many projects are upgraded that don't need to be.
- New versions break lots of gems and useful online tutorials, increasing the value of experience relative to aptitude.
So now, across the world, lots of teams will remove perfectly good code and divert lots of attention to upgrading to Rails 5 for no apparent reason or simply that a higher number is viewed as better.
Contrast this with the node ecosystem where libraries tend to be smaller and significant version bumps typically take an hour or so to accommodate at most.
The worst part is that if you engineered an alternative to action cable (for example) into your app, Rails 5 makes your approach seem outdated for no reason.
And don't get me started on the mess that a node dependency graph can become.
In Ruby and Rails, you basically have to keep updating regardless of the changelog simply to amortize your costs. If you fall too far behind then when you invariably do need to upgrade a dependency, you're going to have to pay all that cost in one swoop and the complexity of that amps up considerably.
My advice is always to upgrade 3-6 months after a major or minor release. After 3 months so that other people have exhaustively documented their troubles and resolved incompatibilities in the libraries they maintain. And before 6 so that Google results for common issues are still fresh.
So I think putting it in terms of "just because" is not really very helpful. In a sense my upgrading in the 3-6 month interval is "just because", but doing it this way keeps the overall maintenance burden to a minimum, since I do have to upgrade sooner or later in order to receive security updates.