-
About
- Bio
- Curriculum Vitae
- Speaking
-
Profiles
- Amazon.com
- DZone
- Found Line
- GitHub
- Google+
- O'Reilly Media
- Ohloh
- php|architect
- Plancast
- SlideShare
- Zend Certified Engineer (ZCE)
-
Publications
-
Videos
-
Conferences
-
Plans
-
Presentations
-
-
Recent Posts
- The Future of CouchDB and Couchbase Server
- Top Five Posts of 2011
- Boston PHP Northeast Conference
- The Twelve-Factor App Applied to PHP
- CouchApps at CouchConf NYC
-
Recent Comments
- CouchApps at jQuery Conference Boston 2011 – Bradley Holt on CouchDB jQuery Plugin Reference
- Guilherme on CouchDB jQuery Plugin Reference
- Jamie Sutherland on Exploring RabbitMQ and PHP
- Bradley Holt on CouchDB jQuery Plugin Reference
- Amir on CouchDB jQuery Plugin Reference
-
Tags
Accessibility Apache Best Practices BTV btvphpug Business CouchApp Couchbase CouchDB CSS Databases Domain-Driven Design eCommerce Folksonomy FOSS Found Line Google HTML5 HTTP JavaScript jQuery JSON Mobile Computing NoSQL Open Networks Open Standards OSCON PHP REST Scaling Social Media Software Deployment Software Design SQL Subversion tekX tekX10 Vermont vtcodecamp XHTML XMPP ZendCon ZendCon08 ZendCon09 Zend Framework
Defining a RESTful Framework
Web application frameworks have varying support for the concepts behind Representational State Transfer (REST). Most web application frameworks, if not all, allow you to create “fully” RESTful web applications. However, there does not seem to be a focus on explicitly applying RESTful principles. So, here are the key concepts that I’d like to see addressed:
- Embrace, and don’t abstract, the Hypertext Transfer Protocol (HTTP).
- Focus on entities/resources—identified by full Uniform Resource Identifiers (URIs).
- Use HTTP methods (
GET
,POST
,PUT
,DELETE
,OPTIONS
,HEAD
) to perform operations on entities/resources. - Allow for self-described messages through the use of header fields, such as
Accept
andContent-Type
. - Make hypermedia controls a core concept (perhaps using PHACTOR as a starting point), not just a byproduct of rendering.
- Think of web applications as state transition systems. Representations of entities/resources are states, and hypermedia controls define the available state transitions.
Benefits:
- Interoperability: Focusing on open standards allows for easier integration with other systems.
- Cacheability: Embracing HTTP gives you many caching options, almost for free.
- Testability: Self-contained and self-describing messages are very testable. Decomposing a complex system into states and available state transitions greatly reduces the complexity of the system and its tests.
Tweet
This entry was written by Bradley Holt, posted on August 19, 2011 at 1:41 pm, filed under Uncategorized and tagged HTTP, Hypermedia, Open Standards, PHACTOR, REST, Web Application Frameworks. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
Both comments and trackbacks are currently closed.
One Comment
It’s funny you made this post. I was just talking about this a lunch. I have a side project I have been working on to do just that, embrace HTTP instead of ignore it. I can’t believe (in PHP at least) that after all of these years there isn’t a single framework that uses what HTTP already gives us in terms on content negotiation, etc.
I am starting a framework for just this case, RestPHP. It is made to simplify the creation of RESTful web services by applying a resource oriented architecture. Each resource class can respond to each of the HTTP methods and will automagically respond with a view subclass that matches the client’s Accept header. It’s isn’t even functioning yet but it’s on GitHub. I’ll start working on it again once I get my beta android app out since it will eventually need to use the service.
https://github.com/Trii/RestPHP