reading RESTful Web Services, Pt2

2007-08-31 @ 01:10#

i just finished the 'middle section' of RESTful Web Services (2007, Richardson and Ruby). this section has the three chapters covering read-only, read-write resource designs and the chapter that covers the details of implementing a REST-ful bookmark web application. all good stuff.

i took some good notes on the chapters (i'll post later) but the thing that really stood out from this session is the chapter that covered using Rails to build the bookmarking app. i've not done any Rails programming and this was the first time i spent serious effort on reading the code. i can see it's appeal. i'm not yet interested in it myself. however, the code (and general patterns) shown in this chapter remind me that my current project (exyus server framework) is heading in a similar direction.

Richardson and Ruby's sample app covers the definition of Controllers to handle the code for each resource including the HTTP actions. there was also an example of using a routes.rb to map URIs to the controllers. finally, the chapter covers the details of filters to describe additional actions to apply to the controllers and models that detail the database interactions.

this all tracks closely with the way i've been implementing exyus. i use the .NET HttpHandler object to define a resource. this is much like the Rails Controller. exyus uses a CustomAttribute called UrlPattern to map a URI against the resource. this is similar to the routes.rb pattern in the chapter. the exyus handlers take leverage XSD to validate inputs (both for Entity bodies and for URI filters) and XSLT to transform both Entity bodies and resulting stored data into the proper internal representations. this seems to track loosely to Rails model and filter patterns. tho, i think i need to do a better job of separating (or at least clarifying) the difference between the filter and model details within exyus.

a final observation is that Rails uses plug-ins for handling conditional GET and for authentication. I've chosen to make both of these 'built-ins' for the exyus framework. that should prove to be a plus in the long-run.

i also need to do a better job of making exyus aware of alternate representations. currently i program both the client and server representations and do not 'sniff' for the Accepts header and act accordingly. this is on my 'futures' list.

code