So, do I still love Rails?
The prototype and first beta version of my startup was built entirely on Rails. The framework enabled us to build our site significantly faster than we would have been able to without it. For that, I still love Rails. It was critical in helping us get to where we are today.
It's the perfect hammer for the v1, nebulous direction, rapid development, nail.
That said, we're not using Rails for any new components.
After getting a lot of feedback from our first beta, we realized we had the wrong approach to the UI. Now, in our second attempt, we've got a much richer client-side front-end, written in CoffeeScript and bootstrapped by Node.js. Ruby/Rails is simply not the right tool for that job. In the new world of the browser app, even the folks of 37signals have been accused of propping up their successor.
Luckily, we had a pretty good handle on the models in the problem domain. So I ran `git rm -r app/views` and effectively turned the Rails app into a Json API backend. The models have evolved, but not by much. In fact, there were a few months where the Ruby code remained practically unchanged while we developed the frontend.
As time goes on, we've been breaking our API layer apart into several services. It makes development, deployment, and versioning easier. Service Oriented Architecture is working great for us... now that we know what services we need. These services are each too simple to justify the overhead of Rails. Some are Node.js, some are Sinatra, some are cron jobs and shell scripts. We're polyglots, so we're careful to choose the right tools for each job.
We'd have gotten it very wrong if we tried to build services from the start. The monolithic Rails app was the correct evolutionary intermediate form.
Given a time machine, would I have done anything differently?
Only one thing: I wouldn't have used ActiveRecord.
I guess I should have seen that one coming. ORMs are an insidious, broken abstraction. At first, they save you time and make you feel productive. They work out splendidly for a while, but like a virus, they infect every part of your application. One day, you hit that abstraction brick wall and it's too late to do anything about it without significant effort.
Ignoring ActiveRecord, only one thing really stands out: Performance.
I'm not even talking about page load times. I'm talking about development time.
Even with our modestly sized application, the impact on productivity is atrocious. Our test suite runs far too slowly to be waited on for every checkin. Rake's startup time is too great to for its usage to be considered "interactive". Simple shell scripts have replaced practically all of our custom tasks; they are instantaneous.
Isn't this basically the same story I told about Django?
Yeah, I guess it is.
The story basically goes:
- Use a framework
- Be productive
- Encounter shortcomings
- Stretch it to work
- Watch it break
- Replace components
- Loop steps three to six
- Be productive
- "Where's the framework?"
I still stand by my original criticisms of Django (although, I'm sure much as changed in the last year). I'm also re-affirmed in my belief that big frameworks are generally bad. It just so happens that Rails is good enough and matches my mindset well enough to justify the framework pains.