Ruby on Rails: Just Say Maybe
I read this little anti-Rails rant Just say no to Ruby on Rails and wanted to share my experience.
I jumped into a couple of little projects using Rails and came away with two key findings.
The first is that some of Rails is brilliant and really makes for rapid development. I'm thinking in particular of the model/view/controller model, routing, and caching.
And the second is that some of Rails is to be avoided, because it trades "magic" for performance.
Generating models from database tables at runtime is slick, and populating whole graphs of objects when you ask for a single entity makes for some cool demos, but really, did anyone think that would scale?
I'm sure I haven't run into the real scalability problems yet, but I've done enough web app development to know that they will be there. But I've also done enough web app development to know how to avoid them. And I think that's the key to creating a successful Rails site.
For example, on the Recipes site, I have objects that represent entities like users and recipes, but generally I write the SQL myself to locate the objects and hand that to find, and I do it one object at a time (not having ActiveRecord hand me an array of categories along with a recipe, for example).
I'm happy enough with the performance of the (still-cheesy) Recipes site now that I have some caching working, and I know the perf problems I still have are more database and query related than Rails related (and something to do with my host having a load average of 6.72 doesn't help, I'm sure).
There's going to be some overhead in Rails compared to ASP.NET or PHP or Python but it's percentages, not factors, so I don't think it's deal-breaking stuff.