No, not the “why do you insist on no more than 5 hours of sleep” kind, but the resource representation kind. Here’s part of a post I read a few days ago:
If I had to choose the single most not-really-well-understood, mystified, unsuccessfully demystified, explained and still not-really-grasped topic in the Rails world (and beyond), my vote would definitely go to REST.
Maybe it’s not quite that bad, but there does seem to be a bit of clarity missing as to why it’s all the rage. I understand some of it, but I think I’m missing most of it. Although, I’ve yet to actually use it. I know it’s been around for quite a while now, but… well… I have no excuses; no real excuses. My shallow excuse would have to be laziness. I’ve been far too lazy the past few months (or year?) to convert a single existing application to REST. And to be honest, aside from laziness, I can’t say that I completely understand the point.
I’m aware of how nice it is for API development, but if there isn’t an exposed API involved, is it really worth it? Is it the clean(er) URLs? The true HTTP caching? A better convention? Nicer routes.rb file? More focused controllers? (Supposedly) better application designs? All of the above?
That stuff is all well and good, but is that really what’s driving this force of RESTful architectures? It just seems like there’s something [bigger] I’m missing.
Regardless, I’ve put it off long enough. Now that Rails 2.0 is on its way, it’s time for me to stop making excuses. I need to get on board so I can realize why it’s so wonderful. Since the core team felt that it was a good thing to integrate REST directly into Rails, I’m sure it is; I just need to learn more about it.
So from here on out, all of my new applications will be RESTful, but I still don’t know that it’s worth converting existing applications. Who knows, though, maybe that’s easy to do.






Comments
In some ways, being RESTful is more difficult, because you have to make sure you are setting the proper
:methodin your forms, etc.Rails 2.0 will make RESTful a bit easier, though.
It’s not a good comparison but I’ll make it anyways – using REST just for the free API is kind of like saying you do TDD just for the unit tests.
I’ve found that REST’s #1 advantage is similar to the main advantage I get from doing TDD – better design. Going to REST simplifies (some might even say normalizes) your controllers.
Check out DHH’s keynote from RailsConf 2006 (make sure you grab the slides beforehand so you can flip through them). Pay special attention to the way he talks about creating a new model rather than adding a non-CRUD action to his controllers.
Then grab the RESTful authentication plugin and notice how when a user logs in, there is no use of a “login” action on the User. Instead, a Session is initiated using “create”. That’s a simple illustration of RESTful design.
Once you come to value that, then you can also sit back and love the side effects that you mentioned like an API, clean URLs, pretty Routes, etc.
Mike—I took your advice and checked out DHH’s keynote. Even though I had seen it before, it was back when I wasn’t following REST at all, so it made a lot more sense this time around.
I’m always open to better design, and I can now see how REST provides for that. Plus, it makes use of the web as it already is, rather than creating yet another layer on top of it, which is something I didn’t really think about before.
I like how it potentially guides what actions are needed, too. There have been many times when I’ve added/removed the same action based on an abrupt decision. It seems like REST will make me think a little harder about what I’m doing, which is always a good thing.
I still feel as though I’ve got a lot to learn, but I’m anxious to dive in. Thanks for the brief insight…