Mittwoch, 20. Mai 2009

So where in REST is the MVC?

Still trying to get my head around REST. Looking at sling, I do see two different approaches:
  • view/model combined: a resource is represented by a markup (html), which contains both view and model information. The controller (browser) is responsible for the correct representation and the hypermedia functionality (hyperlinks, forms), which allows navigation and manipulation of the represented data
  • model exclusively: the resource is represented by a data structure (json), which is both rendered to the controllers (browser) taste as view
Now, from a design point of view, the second one seems cleaner, and very compatible with the MVC pattern. But the first approach is the one the web is build upon, soooo there has to be something about it ...

The idea spinning around in my head is to implement the first approach with Griffon and Sling: Sling will deliver SwingBuilder fragments which then will be interpreted by Griffon. Stay tuned...

1 Kommentar:

fmeschbe hat gesagt…

I have been thinking about this issue, too lately and I am tempted to look at it like this:

Controller: Sling itself (the SlingMainServlet, resource resolver, servlet resolver, filter, some servlets maybe) is the Controller

Model: The Resource and optional Adapters (for example for Jackrabbit Object Content Mappings) are the model

View: The rendering scripts should be the view