Hi Vincent,

> So you're forcing one resource to be aware of other resources 
> just because of
> the way your user interface in designed. If you switch to 
> HTML frames, you no
> longer need these dependencies because each frame displays 
> only one resource
> (the content frame, the profile frame, the navigation frame, etc.). 

Yes, in this case the resource is a "view resource". The addition of frames
wouldn't break the design, the Web representation would just remove the
contextual information (sidebar, etc.) and we would add new dedicated
resources for the other frames.

> And what about cross references? If you click on a post in 
> one of the thread, 
> the 'post' resource must know about the 'profile' resource 
> because it's 
> part of its 'contextual information'. Now let's say you have 
> a 'More' link in
> the profile section to display more of your profile info. In 
> order to redisplay
> the page, the 'profile' resource will have to know about the 
> 'post' resource
> too (because when you GET /profile/123;details, you need to 
> include the
> current post). Imagine the graph (and the resulting 
> maintenance nightmare) if 
> you  have 5 resources displayed on one page.  

I'm not sure to follow you precisely, but for sure a Web page is a
representation of a single target resource. It doesn't matter how many
sub-resources or domain objects were used to build this representation.

> And what if the same resource can be displayed in several 
> type of views? Take
> this forum, for instance: 
> When you a click on a thread, the post is displayed in the 
> bottom part of the
> screen. You can also click on the direct-link and have the 
> post displayed on a
> new page (without the threads). gmane uses frames to achieve 
> this, but how would
> you do it without frames? Include the view in the url?
> 
> GET 
> http://article.gmane.org/gmane.comp.java.restlet/1871;view=threaded
> GET http://article.gmane.org/gmane.comp.java.restlet/1871;view=single
> 
> Or you could decide that what you're viewing is the form, and 
> the uri becomes:
> GET http://article.gmane.org/gmane.comp.java.restlet?activeView=1871
> 
> The danger with this approach is that it forces you to think 
> in terms of pages
> (the forum, the main page, etc.) instead of resources. Or 
> more exactly: 
> your pages become your resources.

Exactly, and their is nothing fundamentaly wrong with this. What is
important is that you don't create unnecessary "page" resources. As soon as
you add a "?page=2" query parameter, you identify a resource that is
separate from the one identified by "?page=3". There is nothing you can do
against this.

What is essential is that your core domain model is well defined and reused
by all your view resources. This core domain model can also be distributed
and implemented as RESTful resource if you can afford this flexibility. 

> I've been thinking a lot about this too, and I came to the 
> conclusion that 
> the best way to put a face on a restfull app is the have the 
> client -not
> the server- assemble the view.
> The simplest (an ugliest) way is to use frames; a better solution is
> to make Ajax calls to the server to retrieve individual 
> resources, and 
> insert the returned html (or xml, json, etc) in the page.
> It also scales better if the application is stateless (no 
> need to retrieve the
> profile each time we display a post). 
> Of course, this is valid only for relatively complex 
> application(e.g. a webmail
>  client). But if your application is restul and your UI 
> moderately complex, it
> calls for a single-page UI (a la GWT) as opposed as the 
> standard multi-page
> design. 

My concern with those approaches (AJAX) is that they somewhat break the
hyperlink design of the Web, and the ability to bookmark each state of your
application.

Best regards,
Jerome  

Reply via email to