[LRUG] Embarrassing Newbie question

Dan Webb dan at danwebb.net
Mon Aug 13 17:45:34 PDT 2007


I've been getting on really well with a very pragmatic approach to
REST.  It's really important to work to expose resources on the front
end that are meaningful to your users.  This may, and usually does,
represent a single model but sometimes can represent a group of models
or event a resource that isn't a model at all (such as a shopping cart
or a user session).  What helps for me is thinking about the URL
structure of the application.  Does a paricular thing need to be
uniquely addressable in the application?  Would a user want to
bookmark it?  Would your potential API (even if you aren't planning
one for your app) benefit from being able to operate on this resource?

For me, especially in a browser context where you only really get GET
and POST and you are only really doing 'pretend' REST, you've got to
be pragmatic and think about your controllers as the API to your
application.  Does having a separate controller/set of URLs to model a
relationship make your apps (virtual) API make sense?  if so then do
it.  If not then it's okay.  You really don't need to feel obliged to
map data models to controllers if it doesn't make sense.  Your
controllers are the view of the application you want to present as
your users.



-- 
Dan Webb
http://www.danwebb.net

Event Wax (http://www.eventwax.com)



More information about the Chat mailing list