Posts Tagged REST
Thoughts about Resource Oriented Programming
This is a brain-dump of some thoughts I have about Resource Oriented Programming/Architecture.
- Unlike OOP in which associations are managed in the objects level, when focusing on resources, the associations are managed in the resource representation, such as using hypermedia’s anchors to link to related resources.
- Resources are mapped to DDD’s Aggregate Root. Inside the aggregate, association to other aggregates should be (/translation should be) supported by the environment like openrasta CreateUri extension method).
- I think OO and RO have different scopes. RO is on the protocol level (it supports rigid and simple interface) - it is the entry point to the domain - the way to manipulate it. It is also not the necessarily the best solution as an entry point. It just fits very well to web applications as HTTP is about resources. Objects on the other hand are a very flexible protocol, this makes them very convenient mean to manage the internal domain but they can be confusing as the external protocol.
REST Resources
When I first heard the term REST and read the wikipedia article about it (which was updated since I first read it) but the impression I got was that REST is about having friendly URLs and using verbs as the way to describe what you want to do.
Only lately I got referred to to this article by my boss, Arnon:
http://www.infoq.com/articles/webber-rest-workflow
Which is a really excellent explanation and example of using rest for integration over the web with emphasis on using http as a state machine (what is known as HATEOAS), usage of the HTTP response codes and HTTP headers and conventions of HTTP verbs (GET, PUT, DELETE are expected to be idempotent).
Reading this article really placed the puzzle pieces in place for me.
Another excellent resource is this presentation about REST patterns and Anti-Patterns.:
With my current knowledge of REST, it really amazes me that for so long I was using the web just as means for tunneling without really harnessing its power. The shift to thinking about entities as identifiable resources that their state can be changed by web calls really simplifies the way I thinks about web applications.
