2005/07/22
Rails impressions
Preliminary cnclusions:
- Yes, I've been quite productive with Rails.
- Yes, the code lines count is now quite low compared to the PHP version.
- No, Rails is no silver bullet.
- Yes, Rails is probably the most productive framework for iterative development of web apps.
Other random notes:
Scaffolding is nice, but slightly over-hyped. Interesting to get the basics in place really fast, but don't expect too much.
I'm still not totally convinced by the find API and the way eager associations work. For instance, especially with the no :limits restriction. Of course, it does not make sense in the general case, but if I'm choosing to have an ORDER BY, I should be allowed to set a limit too.
More generally, RoR is quite "single table-oriented". Expressing request is ok as long as you're dealing with a simple model, but on slightly more complex queries you're on your own. Note that this is not necessarily a bad thing, I'm always a little bit worried of hiding that you're actually working with a DBMS, this could lead to bogus find(:all) followed with a nice if (...) to get the only interesting row, instead of a good old WHERE clause. And I actually saw this in one of the articles about Rails. Again, this is not something against Rails, but by hiding the complexity, it's easier for a novice developer to be fooled. Another issue with handcrafted SQL (for something you can't do easily with the existing API on ActiveRecord) is that you lose some Rails advantages (Paginator comes in mind). It's ok that you can't do over-complex thing with count/find API, but if you choose to express a custom SQL request, you should still have a way to integrate it in the rest of the architecture.
The ActionView helper are nice, but limited in scope. I'd love to see more control in more date handling, HTML stripping. About views: partial layout views are simple, but great. Components are great, too. And as I don't buy the 'we should not have any view logic in views' argument, I'm quite happy with the Rails way. Although I also don't really buy the "auto-compiling on all layers"point, the fact that Rails really pushes hard a model/view/controller/helper separation and refactoring (low barrier on moving code from one area to another) makes the difference.
Another issue. The documentation is rough. Actually, there's a lot of information, just dispersed. Working with a few browser windows open is ok (RoR API, Pragmatic book, Howto + Search, ..)
Finally, I must admit that for the first time, I actually enjoyed writing a web app. Considering that I spent most of my work time developping client-side applications in a very different context, this is a very positive point in itself.