Wednesday, June 20, 2007

I've Consistently Understimated Rails

Every time I've been skeptical about Rails, I've been wrong.

Initially I thought it was something on the level of TurboGears or Nevow; a minor evolution, a package to maybe learn if needed. Turns out it's much more than that.

At Canada on Rails I didn't think Dave Astels' BDD presentation made a word of sense. Today I think RSpec and BDD are the best thing to happen to development practices in years.

The whole REST thing, I just thought it was silly. Turns out REST is the same thing to Rails in 2006 that Ajax was in 2005. The ability to craft APIs cleanly and nearly effortlessly is the advantage that Rails gives to people who are on the very cutting edge. (Obviously that group of people is a group of which I'm not a member, since it took me til mid-2007 to figure this out.) Just to expand on that, the Rails community is growing like crazy, but it's not just how many people, it's also which people that matters. Ajax and now REST are the reason Rails keeps attracting people who do exciting things.

Anyway, back to the whole skepticism thing. The other day I discovered to my surprise that the method_missing code in ActiveRecord's associations needed to be refactored. So I thought aha, that's interesting, and I went into my copy of edge Rails to play around with it, only to find that the refactoring's already underway. The association collection and association proxy classes still use it, but the only actual specific association class still using method_missing at all is has_many :through.

There's a real trend here, and I hope I remember it next time Rails makes me skeptical about something.

2 comments:

  1. I was always under the assumption that you got the REST part of rails and still dissed it anyways. Thats what made me start reading this blog in the first place!

    The only problem with REST in rails is in your rails apps once you start doing similar entities in various scopes and polymorphic routes writing views and proper route redirections + detection in your controllers can become really ridiculous.

    I personally generate & detect my routes now from my models and its saved me hours of headaches and DRY'd my controllers and views.

    The most compelling part of a RESTful design to me right now is in the media space and once you've developed a truly RESTful CMS you basically can blow the doors off of anything out they're right now from a physical distribution perspective.

    ReplyDelete
  2. I got it, but I didn't really get it. I got it abstractly, I didn't realize how useful it could be.

    How do you detect/generate your routes from your models? That sounds like nifty code.

    ReplyDelete

Note: Only a member of this blog may post a comment.