« Change to REST URLs for Rails 2.0 | Main | The coolest app you never knew was on your hard drive »

March 29, 2007

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83451c41c69e200d8341c630153ef

Listed below are links to weblogs that reference The RADAR Architecture: RESTful Application, Dumb-Ass Recipient:

» PragDave nails it. Again. from Just A Summary
REST is easy, its just smart clients using HTTP to the full. Except, as Dave PragDave Thomas points out, browsers arent smart. Theyre just dumb terminals with prettier graphics. And what does that mean? It means that a t [Read More]

» Arquitetura RADAR: Aplicações RESTful, Recebedor Trivial from Balance On Rails
Faz tempo que não faço nenhuma tradução por aqui, mas para não perder o costume esbarrei neste artigo de Dave Thomas. É um texto importante por ajudar a entender o conceito de REST e a sugestão de uma nova arquitetura, uma vez que o novo Rails 1.2 [Read More]

» Morning Coffee 64 from DevHawk
[Read More]

» And then there was... from Tammer Saleh
This has been feeling to me, lately, like the natural progression of things, especially with this sitting just around the corner [Read More]

Comments

linoj

why not just article/1.form for the edit form (versus 1.html for show)?

Oleg Andreev

Hi, Dave!

Thanks for such a good picture of RADAR.
I have a better vision. With not so dumb-ass clients, as browsers happen to be right now.

Here I replace Ajax.Request with ActiveResource on JS:
http://novemberain.com/2007/4/20/js-goes-rest

Don't mind the cyrillics; see the code and (especially) redesigned picture.

It would be great if you drop a line about the idea.

Fabio Papa

It seems to me that using REST is worth it (to the programmer) just solely on the basis of the url helpers (:get => post_url(123) instead of :action => :show, :controller => :posts, :id => 123), and the resource nesting, even if you don't care about RESTful clients, etc.

And another thing . . . :) Browsers aren't so dumb. In fact, to use your example, Dave (who's books and views I adore), the atom client is dumber. The atom client can only handle pure xml resources. We're sending browsers all sorts of html intermingled with resources. I'm sure somebody could write an extension for stupid firefox in about fifteen minutes to fetch, edit and submit an xml resource. I'd like to see smarty-pants atom handle the css box-model. No, if anything is of below-average intelligence in this layer cake we call the web, it is html. Yes, browsers need to start implementing all of the REST verbs, but that's not the problem, we can fake it like we have been. The problem is that we (the programmers) aren't telling these innocent, hard-working browsers that we're sending them a resource intermixed in all that presentation code. We need a standard that allows us to tell the browser, "this is a resource that can be edited." Then the browser could easily create a form on the spot for the resource without GETting any evil semi-coloned URIs (without requesting anything at all, for that matter). Am I wrong?

Dave Thomas

Fabio:

Don't confuse the implementation with the architecture :)

The helpers are easily written independent of the underlying transport (RESTful or not).

And the fact that Atom is simple is actually the point. If browsers could support that kind of protocol, but provide a rich user experience, then we'd be in a lot happier place. But the reality is that even the cleverest client code is only going to provide an anodyne user interface if it relies solely of data-only payloads from the server. This kind of technology is tried every 8-10 years, and it never really works (so far).

So all I'm advocating is a separation of concerns; we have the application logic in a RESTful server, and presentation logic elsewhere, either on another server or on the client (where it's likely to require more than simple forms-bqased-on-data style of interface).

Fabio Papa

Thanks for your response, Dave.

You are bang-on about the helpers being independent from REST. Thanks.

As for the rest (no pun intended), I guess I am just idealistic: having a beautiful, RESTful app with a non-REST interface for browsers Just Smells Bad(tm). No more pesky semicolons and repetitive respond-to stanzas, but isn't there going to be repitition amongst your (ActiveRecord) models in the RESTful app and your (ActiveResource) models in your "browser-only" app (validations, associations, etc.)?

Data-only payloads??? No way! We've come so far with css and un-obtrusive javascript and, most of all, xhtml. That's not at all what I'm suggesting. All I proposed, rather poorly apparently, was to _extend_ xhtml to allow us programmers to tell the browsers that amongst all that presentation mark-up there is a resource (or resources). Then the browser could choose to display that resource in a view-only way or an editable way based on the user clicking an edit button, or something. Sure you could do that with javascript, but then you'd have to deal with users that don't have javascript or have it disabled. An addition to xhtml would mean that it would (eventually) work on all browsers. A fielding-esque dream, maybe.

To put it another way: when a browser requests a universal RESOURCE locator (or indicator) it gets back the resource, plus a whole bunch of other information on how to frame and display that resource in a way that human eyes can grasp it. The problem is that no distinction is made (indeed none can be made) between the the framing and displaying of the resource, and the resource itself. There is no separation of the human-readable and the machine-readable. I believe that extending our beloved extensible mark-up language to enable it to make such a distinction is the best way, long-term and independent of which framework you choose to use, to allow us to have truly RESTful apps.

Thanks for igniting this, Dave.

bryanl

Last night at our B'More on Rails[1] meeting, I brought this article up. This idea make lots of sense to me, and now you have inspired us to bake up a proof of concept.

Thanks :)

[1] http://ruby.meetup.com/85/

Breton

"But, what if the app didn't define "brief" and that's what I needed? I'd have to make 4 GETs, right? One for each part {title, author, abstract, conclusion}.

Is it better to do the REST thing and make 4 GETs, or is it better to build a custom RPC? I ask that in all sincerity, for it seems to me that most applications will need, over time, the flexibility to GET custom sets of items or attributes. And, if I have to build that flexibility, when do I get to use REST? "

Then you use the query syntax documents/5?title=show&author=show&abstract=show&conclusion=show and you build your application to respond to that.

People mix up REST with the concept of beautiful URL's, when in fact, REST is just adhering to the semantics of the http spec, nothing more. It's the idea that RPC is a similar abuse of semantics as tables for design. http defines the query syntax, for querying collections of documents using named parameters.

the http spec defines no semantics for the semicolon, but still reserves it for application authors. sir Tim Berners Lee wanted to use semicolons for representing dimensional spaces- such as maps, which are not suited to representation using a heirarchical notation. Different views of the same resource are very similar to different views of a 2d map. A map is a single thing, and TBL is using semicolons to specify different views for that same map resource.

http://www.w3.org/DesignIssues/Axioms.html#matrix

a year and a half, or some time ago, I was reading the http spec, discovering these things, and posting to a mailing list about REST, and getting rather excited about my discoveries. DHH, just by chance, happened to be reading the same mailing list. I got excited about semicolons directly at him in a campfire session. I explained everything I just did to you. He was intrigued, when I pointed out that ; and ? have different semantics. Next thing you know, semicolons are in rest on rails.

Which, may go some way to explaining why he says it was a "Neat idea, but not worth it" when removing semicolons. I hyped him up on the semicolon. It's rather dissappointing that it causes so many problems with proxies and safari- It means that safari is in violation of the http spec, which specifically tells clients to NOT screw up with semicolons.


breton

here's a better link to sir Tim Berners-Lee's explanation of Matrix URI's (which use the semicolon)

http://www.w3.org/DesignIssues/MatrixURIs.html

nitendra

Hi,
Its Nitendra Mahajan here, i would like to know how the actual diff will happen while working of application server and web server independently..please let me know diff between app and web server architecture


with regards
nitendra.

jordan shoes

I didn't know we were now moving away from RESTful URLs. In any case you could make them discoverable via a central page that listed all the root resources that the server provides, and so on.

ugg boots

Good topic. thanks.

ryw

Hi Dave, thanks for the article.

We're getting ready to rebuild our apps architecture (see http://www.rywalker.com/chaos-2010 for more details), we considered RADAR-like architecture a few years ago, but decided to no decouple the rails models from the views of the apps, it just didn't seem like the extra benefit was worth the pain of having to duplicate code potentially in places...

What's your take on RADAR architecture in 2010 - are you more a fan of the idea today?

We're considering using something like Sinatra/Riak @ the webservice layer by the way, rather than two rails apps.

Bothb

This isn't exactly RADAR, but it does decouple the model from the view: http://documentcloud.github.com/backbone/

It should let us write modular views in js that can be used in multiple web apps. For example, an "employee selector" for choosing an employee name, and an "employee checkbox list" for choosing multiple employees. Write once, use in all our apps, (or at least that's the hope.)

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Now in Beta

  • Programming Ruby, 3rd Edition
    Third Edition, Covering Ruby 1.9, now available
My Photo

Pragmatic Stuff

Photos

  • www.flickr.com
    This is a Flickr badge showing public photos from pragdave tagged with pragdave_badge. Make your own badge here.

Site Search

  • Google Search

    The web
    PragDave