"@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 :(
- actively developed framework -> upgrade fun
- not actively developed framework -> security issues, trouble hiring devs, missing features, et cetera
- no framework, (also known as roll your own) -> much harder for new team to come up to speed on the code base
I contend that the first is the best of the bad choices.
The good news is that Rails is now mature, so the upgrade path tends to be easier than it was in the early days.
I am not talking about `bundle update` on a production server :)
But of course it doesn't fit everyone needs.
For instance, there is no Devise equivalent. No modular authentication package that you can just plug in and configure in 15 mins. Horrible.
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.
The whole issue of bloat in Rails is overblown because Rails has been quite modular since version 3.
I don't think Phoenix would be as bloated as Rails in 10 years because the platform we are using is just a better platform for the web and for building distributed systems (which Action Cable with Redis plus client-server effectively is).
As an exercise, compare the implementation of channels in Phoenix and Rails. The Phoenix implementation is less lines of code (without counting the dependencies Rails brings in) while being more modular: the PubSub system is pluggable and we support multiple transports between client and server (WebSockets and LongPolling officially, embedded stuff coming soon™). Plus every Phoenix channel is concurrent and isolated. In the screencast, DHH says to avoid work on the channel to avoid blocking, in Phoenix you don't have to worry about it, at all. In this particular scenario, we do much more with much less.
The most interesting of all is that not along ago I had similar expectations as you when it comes to certain parts of Phoenix like "Phoenix.HTML". I was concerned that Phoenix.HTML would be more verbose than the Rails counterpart, both in implementation and usage. I was very pleasantly surprised when it was not the case. For example, check how we support different inputs in Phoenix (https://github.com/phoenixframework/phoenix_html/blob/master...) and in Rails (https://github.com/rails/rails/tree/master/actionview/lib/ac...). In Phoenix, a new input is a simple function, in Rails it is a class with inheritance on its own file.
Those are just some examples from the top of my head and while I am still learning as I go, I have gathered enough mileage and evidence to expect things to be much simpler in the long term. :)
Seriously, I'm not worried about Phoenix, but then I don't mind the bloat in Rails, since it is modular (as is Phoenix). I would be sad though if Phoenix went explicitly away from Rails in the direction of Nodejs (composing apps with lots of smaller independent libraries, requiring more configuration) because "Rails is bloated, bloat is bad".
And to grandparent `laut, thanks for provoking this discussion! :)
Well, Erlang architecture, but yeah. With Erlang you basically obviate the need for Redis, Eventmachine, Celluloid and that whole web socket handling stack because all of that is built in to Erlang/OTP.
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.
As far as LFE goes.. implementing a LISP-1 on top of erlang seems like a perfectly reasonable thing to do, but why invent some new funky syntax (elixer) ?
Syntax is the first thing José Valim discards on the talk, he then goes on to talk about polymorphism, collections, tooling and so on.
Also, both Elixir and LFE have two namespaces, so none of them would be equivalent to a LISP-1.
Microseconds I say, microseconds! :) in development!
But it seems to have made it into the beta as a gem dependency.
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).
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.
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.
 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,
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.
> on the server, too, with node.js?
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." :)
Interestingly enough, that's not too dissimilar to the ActionCable model despite using slightly different techs.
Long story short, I had no issues with this set up and it's been running for around a year. I'm not at roflcopter scale, but it churns out about 100k events per month through Rails->Sidekiq->Faye without breaking a sweat.
The Faye server doesn't know or care about Rails. It just needs to do its job of broadcasting the event to subscribers.
Sidekiq is there for me to easily monitor the events processed, and in theory the Rails app may not be in the same private network as the Faye server, so I decided to make the POST requests happen in Sidekiq. It seems like a good spot for that, since it's a "send it and move on with life".
The Faye server pretty much runs itself, it's been going for months and months without maintenance. Sidekiq gets updated once in a while because I'm using it for other things too and sometimes the app code for it changes, not a big deal tho.
Phoenix will have to wait.
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?
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]
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!
Getting stuck on 2.3 isn't desirable.
Everything else at the company is microservices now, but this one system still has a few million customers.
The question is whether they have the economics right to earn a nice profit; could be tricky, but I guess if you do it day in and day out you get it dialed in pretty well.
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?
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.
- 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.
Unfortunately, my point was more that you can't just not upgrade Rails. Eventually everything else you use will require newer Rails and upgrading at that point becomes extraordinarily difficult. E.g., ActiveRecord plugins often just monkeypatch the internals, which are naturally free to change from release to release. However, most gem authors don't want to test against multiple versions, so the latest becomes the only supported one and you have to upgrade "just because."
 -- https://github.com/ronin-ruby/ronin/
"Eventually everything else you use will require newer 'x'", I think this is a problem even with non-frameworks. Imagine any core to your functionality lib getting far out of date. Dependency graphs are hard to manage over time.
I don't see it so much as a technical limitation of Ruby, but simply the way the community has evolved. With other ecosystems, the emphasis is often on stability by sticking what's known to work. Abstractly they have the same dependency graph problems, but in practice their problems and solutions are quite different.
Upgrading Rails can force upgrades on a lot of other things, however. And new bugs get introduced all the time. Performance regressions happen. Etc. There should be a more compelling reason to upgrade than the version number changed, given the additional risk you take. Unfortunately, that's often not the case.