Broken web sites still broken

The Google Web Accelerator has just been brought back, apparently. I don’t care much, except to note that it’s caused the rails people to go, well, off the rails. Again.

I don’t really have much to add to the discussion, except to point at Aristotle’s choice extracts. In a sense this is all quite amusing, except for the fact that the rails people still don’t grok what they’re getting wrong.


Why we need REST

There’s a neat new toy from google—the Google Web Accelerator (GWA). It uses Googles cache to serve up web pages quickly, but it also apparently does link prefetching. This is good for the most part, as it speeds things up a lot.

The difference between GWA and Mozilla is that GWA pre-fetches every single link on the page if it doesn’t find a <link rel="next"> on that page.

This combines with the fact that some people have links to “delete” and “cancel” on their web sites.

Now, the HTTP spec says that if you GET a page, then that must cause no change on the server side (safe). By creating a link that deletes something, you are breaking the rules.

Of course, if browsers supported HTTP a bit better, then they’d use a DELETE verb for such an action. But even without that, you can still use a form and POST for non safe actions. It’s definitely worth bearing in mind next time you’re writing a web app.

Update: Tom Mortoel has described the problem better than I have. And also offered actual code for a solution, which helps. Also note the informative comments.


Ruby on Rails and REST

I’ve spent a little while over the last few days looking at Ruby on Rails. It seems to live up to the claims of its proponents. You can develop applications very quickly indeed, and it’s easy to get a good separation of concerns. If you haven’t played with it before, have a look at the TODO list examples: Making a todo list and Four Days on Rails. Overall, I’m really, really impressed.

I do have one gripe through (hey, it’s software!) and that’s the lack of RESTability. I’m really keen on using REST interfaces where possible, as I’ve found them remarkably easy to reuse. Ruby appears to go some way towards this, by focusing on a very nice clean URL structure. But one key aspect is missing: dispatch on method names. As Mark Nottingham pointed out, to get a good RESTful interface, you need to dispatch on both URI and method name.

The good news is that Ruby is architected really well, so to get this kind of behaviour should simply be a case of subclass ActiveController::Base or perhaps the Dispatcher itself. I dunno. But it looks eminently doable.